_options['cache_id_prefix'])) { $id = $this->_options['cache_id_prefix'] . $id; } } return $id; } /** * Prepare tags * * @param array $tags * @return array */ protected function _tags($tags) { foreach ($tags as $key=>$tag) { $tags[$key] = $this->_id($tag); } return $tags; } /** * Save some data in a cache * * @param mixed $data Data to put in cache (can be another type than string if automatic_serialization is on) * @param string $id Cache id (if not set, the last cache id will be used) * @param array $tags Cache tags * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends * @throws Zend_Cache_Exception * @return boolean True if no problem */ public function save($data, $id = null, $tags = array(), $specificLifetime = false, $priority = 8) { $tags = $this->_tags($tags); return parent::save($data, $id, $tags, $specificLifetime, $priority); } /** * Clean cache entries * * Available modes are : * 'all' (default) => remove all cache entries ($tags is not used) * 'old' => remove too old cache entries ($tags is not used) * 'matchingTag' => remove cache entries matching all given tags * ($tags can be an array of strings or a single string) * 'notMatchingTag' => remove cache entries not matching one of the given tags * ($tags can be an array of strings or a single string) * 'matchingAnyTag' => remove cache entries matching any given tags * ($tags can be an array of strings or a single string) * * @param string $mode * @param array|string $tags * @throws Zend_Cache_Exception * @return boolean True if ok */ public function clean($mode = 'all', $tags = array()) { $tags = $this->_tags($tags); return parent::clean($mode, $tags); } /** * Return an array of stored cache ids which match given tags * * In case of multiple tags, a logical AND is made between tags * * @param array $tags array of tags * @return array array of matching cache ids (string) */ public function getIdsMatchingTags($tags = array()) { $tags = $this->_tags($tags); return parent::getIdsMatchingTags($tags); } /** * Return an array of stored cache ids which don't match given tags * * In case of multiple tags, a logical OR is made between tags * * @param array $tags array of tags * @return array array of not matching cache ids (string) */ public function getIdsNotMatchingTags($tags = array()) { $tags = $this->_tags($tags); return parent::getIdsNotMatchingTags($tags); } }