Zend Framework Clear Cache

I use this code to cache an array as part of zend:

$frontendOptions = array( 'lifetime' => 24 * 3600 * 7, // cache lifetime of 7 day 'automatic_serialization' => true ); $backendOptions = array( // Directory where to put the cache files 'cache_dir' => APPLICATION_PATH .'/../tmp' ); // getting a Zend_Cache_Core object $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); $CacheName = ('VOUCHER_MANAGEMENT'); $CacheResult = $cache->load($CacheName); if($CacheResult === false) //make cache else //use cache 

Now, how can I clear the cache manually?

+4
source share
1 answer

According to the documentation , one call to the remove() method is enough, i.e. delete specific cache element:

 $cache->remove($CacheName); 

If you want to clear obsolete cache elements, call the clean() method:

 $cache->clean(Zend_Cache::CLEANING_MODE_OLD); 

To delete all items in the cache:

 $cache->clean(Zend_Cache::CLEANING_MODE_ALL); 
+7
source

All Articles