/** * Clear type cache using metas * * @param string $type : the cache type to clear * @param array $metas : the cache metas to clear * @param contant $mode : the zend cache constant to clean matching cache * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG (default) * Zend_Cache::CLEANING_MODE_MATCHING_TAG * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG * @return boolean * @access public * @static */ function clearTypeCacheByMetas($type, $metas, $mode = Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG) { $type = io::sanitizeAsciiString($type); //Convert metas into tags $tags = CMS_cache::_createTags($metas); //CMS_grandFather::log('Clear cache '.$type.' for metas '.print_r($tags, true).' ('.io::getCallInfos().')'); $return = true; //check cache dir $cachedir = new CMS_file(PATH_CACHE_FS . '/' . $type, CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY); if ($cachedir->exists()) { //Frontend cache options $frontendOptions = array('lifetime' => null, 'caching' => true, 'automatic_cleaning_factor' => 10); //Backend cache options $backendOptions = array('cache_dir' => PATH_CACHE_FS . '/' . $type, 'cache_file_umask' => octdec(FILES_CHMOD), 'hashed_directory_umask' => octdec(DIRS_CHMOD), 'hashed_directory_level' => 1); // getting a Zend_Cache_Core object try { $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); } catch (Zend_Cache_Exception $e) { CMS_grandFather::raiseError($e->getMessage()); } if ($cache) { try { $return = $cache->clean($mode, $tags); } catch (Zend_Cache_Exception $e) { CMS_grandFather::raiseError($e->getMessage()); $return = false; } } else { $return = false; } } return $return; }