Example #1
0
 /**
  * @param $id
  * @return bool|int
  */
 public function removeByPartialId($id)
 {
     if (is_object($this->_cache)) {
         $counter = 0;
         $cacheIds = $this->_cache->getIds();
         foreach ($cacheIds as $cid) {
             if (strpos($cid, $id) !== false) {
                 $this->_cache->remove($cid);
                 $counter++;
             }
         }
         return $counter;
     }
     return false;
 }
Example #2
0
 /**
  * @group tags
  */
 public function testCleanAnyMatchingTag()
 {
     $this->setKeys();
     $this->cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('tag_a1', 'tag_a3'));
     $ids = $this->cache->getIds();
     sort($ids);
     $this->assertEquals(array('test_ccc'), $ids);
 }
 /**
  * Fetch an array of all keys stored in cache
  *
  * @return array Returns the array of cache keys
  */
 protected function _getCacheKeys()
 {
     $ids = $this->_cache->getIds();
     $prefix = $this->getPrefix();
     $length = strlen($prefix);
     foreach ($ids as $key => $id) {
         $ids[$key] = substr($id, $length);
     }
     return $ids;
 }
Example #4
0
 /**
  * Returns the page item cache.
  *
  * @return array
  */
 public function getPageItemCache()
 {
     $data = array();
     if ($this->_cacheEnabled()) {
         foreach (self::$_cache->getIds() as $id) {
             if (strpos($id, self::CACHE_TAG_PREFIX) !== false) {
                 if (preg_match('|' . self::CACHE_TAG_PREFIX . "(\\d+)_.*|", $id, $page)) {
                     $data[$page[1]] = self::$_cache->load($this->_getCacheId($page[1]));
                 }
             }
         }
     }
     return $data;
 }
Example #5
0
 public function hasSiteinfo($suffix)
 {
     $ids = self::$_cache->getIds();
 }