Zend Cache is not retrieving cache items after some period of time

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-05-13T04:44:29Z Indexed on 2010/05/13 4:54 UTC
Read the original article Hit count: 517

Filed under:
|
|

Hi, I am using Zend Cache with page caching but it seems to miss the cache after a period of time. For a while it is OK, but I come back tomorrow and hit the page, it doesn't fetch the contents from the cache. why?

$frontendOptions = array(
    'content_type_memorization' => true, // This remembers the headers, needed for images
   'lifetime' => NULL,                   // cache lifetime forever
   'automatic_serialization' => true,
   'automatic_cleaning_factor' => 0
);

$myPageCache = new Zend_Cache_Frontend_Page(array(
    'debug_header' => false,
    'automatic_cleaning_factor'=>0,
    'content_type_memorization' => true,
    'default_options'           => array(
    'cache' => true,
    'cache_with_get_variables' => true,
    'cache_with_post_variables' => true,
    'cache_with_session_variables' => true,
    'cache_with_cookie_variables' => true
    )));


$backendOptions = array('cache_dir' => '.' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR);

$cache = Zend_Cache::factory($myPageCache,
                             'File',
                             $frontendOptions,
                             $backendOptions);

$cacheKey = hash('md5', "cache_" . $cachePath); // cachePath is the key I use for the cache

if(!$cache->start($cacheKey)) {
I output html here
 $cache->end();
}

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about cache