| 112 | | if ($this->response->getStatusCode() == 200) |
|---|
| 113 | | { |
|---|
| 114 | | $uri = $this->routing->getCurrentInternalUri(); |
|---|
| 115 | | |
|---|
| 116 | | // save page in cache |
|---|
| 117 | | if ($this->cache[$uri]['page']) |
|---|
| 118 | | { |
|---|
| 119 | | // set some headers that deals with cache |
|---|
| 120 | | $lifetime = $this->cacheManager->getClientLifeTime($uri, 'page'); |
|---|
| 121 | | $this->response->setHttpHeader('Last-Modified', $this->response->getDate(time()), false); |
|---|
| 122 | | $this->response->setHttpHeader('Expires', $this->response->getDate(time() + $lifetime), false); |
|---|
| 123 | | $this->response->addCacheControlHttpHeader('max-age', $lifetime); |
|---|
| 124 | | |
|---|
| 125 | | // set Vary headers |
|---|
| 126 | | foreach ($this->cacheManager->getVary($uri, 'page') as $vary) |
|---|
| 127 | | { |
|---|
| 128 | | $this->response->addVaryHttpHeader($vary); |
|---|
| 129 | | } |
|---|
| 130 | | |
|---|
| 131 | | $this->setPageCache($uri); |
|---|
| 132 | | } |
|---|
| 133 | | else if ($this->cache[$uri]['action']) |
|---|
| 134 | | { |
|---|
| 135 | | // save action in cache |
|---|
| 136 | | $this->setActionCache($uri); |
|---|
| 137 | | } |
|---|
| | 112 | if (200 != $this->response->getStatusCode()) |
|---|
| | 113 | { |
|---|
| | 114 | return; |
|---|
| | 115 | } |
|---|
| | 116 | |
|---|
| | 117 | $uri = $this->routing->getCurrentInternalUri(); |
|---|
| | 118 | |
|---|
| | 119 | // save page in cache |
|---|
| | 120 | if ($this->cache[$uri]['page']) |
|---|
| | 121 | { |
|---|
| | 122 | // set some headers that deals with cache |
|---|
| | 123 | $lifetime = $this->cacheManager->getClientLifeTime($uri, 'page'); |
|---|
| | 124 | $this->response->setHttpHeader('Last-Modified', $this->response->getDate(time()), false); |
|---|
| | 125 | $this->response->setHttpHeader('Expires', $this->response->getDate(time() + $lifetime), false); |
|---|
| | 126 | $this->response->addCacheControlHttpHeader('max-age', $lifetime); |
|---|
| | 127 | |
|---|
| | 128 | // set Vary headers |
|---|
| | 129 | foreach ($this->cacheManager->getVary($uri, 'page') as $vary) |
|---|
| | 130 | { |
|---|
| | 131 | $this->response->addVaryHttpHeader($vary); |
|---|
| | 132 | } |
|---|
| | 133 | |
|---|
| | 134 | $this->setPageCache($uri); |
|---|
| | 135 | } |
|---|
| | 136 | else if ($this->cache[$uri]['action']) |
|---|
| | 137 | { |
|---|
| | 138 | // save action in cache |
|---|
| | 139 | $this->setActionCache($uri); |
|---|