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