Thursday 30 April 2015

How to delete the Zend Cache files from server

How to delete the zend cache files from server

How to create an object of Zend Cache
$cache = Zend_Cache::factory(
                        'Core', 'File', array(
                    'lifetime' => 3600 * 24 * 7, //cache is cleaned once a day                            
                    'automatic_serialization' => true
                        ), array('cache_dir' => APPLICATION_PATH . '/cache')

Remove the cache by cache-id In this only one cache file will be removed from server.

Remove All cache files from Server. (When we delete files, caching automatic clear because we are using cache in files)

Remove all outdated caching files.

Remove the cahe files which have two tags.
    array('matchingTag1', 'matchingTag2','matchingTag3') //Will remove which have matchingTag1 and matchingTag2 and matchingTag3

Remove all files which have not tag assign few tags.
    array('NotmatchingTag1', 'NotmatchingTag2') //Will Remove all the cahce which are NOT tagged with NotmatchingTag1 OR NotmatchingTag2

Remove all the cache files which have any tag (any of two or three).
    Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, //Will remove which have matchingTag1 OR matchingTag2 OR matchingTag3
     array('matchingTag1', 'matchingTag2','matchingTag3')