Example #1
0
 public function getCacheHeaders(ConcretePage $c)
 {
     $lifetime = $c->getCollectionFullPageCachingLifetimeValue();
     $expires = gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT';
     $headers = array('Pragma' => 'public', 'Cache-Control' => 'max-age=' . $lifetime . ',s-maxage=' . $lifetime, 'Expires' => $expires);
     return $headers;
 }
Example #2
0
 public function getCacheHeaders(Page $c)
 {
     $lifetime = $c->getCollectionFullPageCachingLifetimeValue();
     $expires = gmdate('D, d M Y H:i:', time() + $lifetime) . ' GMT';
     $headers = array('Pragma: public', 'Cache-Control: s-maxage=' . $lifetime, 'Cache-Control: max-age=' . $lifetime, 'Expires: ' . $expires);
     return $headers;
 }
 public function set(ConcretePage $c, $content)
 {
     if (!is_dir(Config::get('concrete.cache.page.directory'))) {
         @mkdir(Config::get('concrete.cache.page.directory'));
         @touch(Config::get('concrete.cache.page.directory') . '/index.html');
     }
     $lifetime = $c->getCollectionFullPageCachingLifetimeValue();
     $file = $this->getCacheFile($c);
     if ($file) {
         $response = new PageCacheRecord($c, $content, $lifetime);
         if ($content) {
             file_put_contents($file, serialize($response));
         }
     }
 }
Example #4
0
 public function set(Page $c, $content)
 {
     if (!is_dir(DIR_FILES_PAGE_CACHE)) {
         @mkdir(DIR_FILES_PAGE_CACHE);
         @touch(DIR_FILES_PAGE_CACHE . '/index.html');
     }
     $lifetime = $c->getCollectionFullPageCachingLifetimeValue();
     $file = $this->getCacheFile($c);
     if ($file) {
         $response = new PageCacheRecord($c, $content, $lifetime);
         if ($content) {
             file_put_contents($file, serialize($response));
         }
     }
 }
Example #5
0
 public function set(Page $c, $content)
 {
     if (!is_dir(DIR_FILES_PAGE_CACHE)) {
         @mkdir(DIR_FILES_PAGE_CACHE);
         @touch(DIR_FILES_PAGE_CACHE . '/index.html');
     }
     /* WEIYM: tune to support cache for mobile */
     if (!is_dir(DIR_FILES_PAGE_CACHE_MOBILE)) {
         @mkdir(DIR_FILES_PAGE_CACHE_MOBILE);
         @touch(DIR_FILES_PAGE_CACHE_MOBILE . '/index.html');
     }
     $lifetime = $c->getCollectionFullPageCachingLifetimeValue();
     $file = $this->getCacheFile($c);
     if ($file) {
         #error_log ("To save page to cache file: $file\n", 3, '/var/tmp/c5.log');
         $response = new PageCacheRecord($c, $content, $lifetime);
         if ($content) {
             file_put_contents($file, serialize($response));
         }
     }
 }