public function testRemove() { $this->rediska->set('test', array('aaa', time(), null)); $this->cache->remove('test'); $reply = $this->rediska->get('test'); $this->assertNull($reply); }
/** * Empty this cache instance */ private function _deleteCache() { if ($this->_cache instanceof \Zend_Cache_Core) { $this->_cache->remove($this->_cacheid); $this->_cache->remove($this->_cacheid . 'trans'); } }
/** * * @group cache_remove */ public function testRemove() { $this->cache->save('', 'test_data'); $reply = $this->cache->load('test_data'); $this->assertFalse($reply); $this->cache->save('aaa', 'test_data'); $reply = $this->cache->load('test_data'); $this->assertEquals('aaa', $reply); $this->cache->remove('test_data'); $reply = $this->cache->load('test_data'); $this->assertFalse($reply); }
/** * @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; }
/** * 清除权限关系缓存 * * @return boolean */ public function removeAclsCache() { if (null !== self::$_cache) { return self::$_cache->remove('acl'); } return true; }
/** * @return controlar */ private function _prepareAcl() { if (!is_null($this->usuario) && !is_null($this->usuario->ID_UNIDADE)) { // atualizar informações da unidade do usuário na sessão // com as informações do banco, a menos que o usuário tenha trocado // Testar a existência de um cache de acl para o usuário if (!$this->cache->test('acl_' . $this->usuario->ID)) { $this->acl = AclFactory::createAcl($this->usuario); $this->cache->save($this->acl, 'acl_' . $this->usuario->ID, array('acl_usuario_' . $this->usuario->ID, 'acl_unidade_' . $this->usuario->ID_UNIDADE)); } else { $this->acl = $this->cache->load('acl_' . $this->usuario->ID); if ($this->usuario->ID_UNIDADE != $this->acl->getIdUnidade()) { if (!$this->acl->isTrocouUnidade() && !$this->usuario->TROCOU) { // id do cache e da session não batem, e usuário não trocou de unidade // limpar o cache e recriá-lo $this->cache->remove('acl_' . $this->usuario->ID); $this->cache->clean('matchingAnyTag', array('acl_usuario_' . $this->usuario->ID)); $this->acl = AclFactory::createAcl($this->usuario); $this->cache->save($this->acl, 'acl_' . $this->usuario->ID, array('acl_usuario_' . $this->usuario->ID, 'acl_unidade_' . $this->usuario->ID_UNIDADE)); // limpar } } $this->usuario = $this->acl->updateSession(); } // Forçar permissão de troca de unidades pro usuário que já trocou de unidade if ($this->acl->isTrocouUnidade()) { $this->acl->allow($this->usuario->ID, 115); } } return $this; }
/** * Remove cached data by identifier * * @param string $id * @return bool */ public function remove($id) { Magento_Profiler::start('cache_remove', $this->_generateProfilerTags('remove')); $result = $this->_frontend->remove($this->_id($id)); Magento_Profiler::stop('cache_remove'); return $result; }
/** * Deletes the specified session from the source. * * @param string $sessionId */ public function deleteSessionFromSource($sessionId) { if ($this->_cache) { $this->_cache->remove($this->_getSessionCacheName()); } else { $this->_db->delete($this->_config['table'], 'session_id = ' . $this->_db->quote($sessionId)); } }
/** * Empty the cache of the organization * * @return \Gems_User_Organization (continutation pattern) */ public function invalidateCache() { if ($this->cache) { $cacheId = $this->_getCacheId(); $this->cache->remove($cacheId); } return $this; }
/** * Save the cache here */ public function __destruct() { // \MUtil_Echo::track(count($this->_commands)); if ($this->_commands) { $this->_cache->save($this->_commands, $this->_cacheId, array('batch', 'sess_' . session_id())); } else { $this->_cache->remove($this->_cacheId); } }
/** * Removes a key from the store * * @param string $key * @return boolean */ public function remove($key) { if (null !== $this->cacheAdapter) { $this->logMessage('Removed key ' . $key); $prefixedKey = $this->prefixKey($key); return $this->cacheAdapter->remove($prefixedKey); } return false; }
/** * Récupère l'instance du singleton en gèrant la persistance * * @param bool $clearCache détruit le cache auparavant * @return Cache_Acl */ public static function getInstance($clearCache = false) { if (static::$_cache) { if ($clearCache) { static::$_cache->remove(self::CACHE_KEY); } if (false === (static::$_instance = static::$_cache->load(self::CACHE_KEY))) { if (static::$_instance == null) { static::$_instance = new static(); } static::$_cache->save(static::$_instance, self::CACHE_KEY); } } else { if (static::$_instance == null) { static::$_instance = new static(); } } return static::$_instance; }
/** * Remove cache matching id, prefix or tags * @param string $cacheId cache id to remove * @param string $cachePrefix cache prefix to remove * @param array $tags array of cache tags to remove */ public function clean($cacheId = '', $cachePrefix = '', $tags = array()) { $tags = $this->_sanitizeTags($tags); $this->_cache->clean(Zend_Cache::CLEANING_MODE_OLD); if (!$cachePrefix && !$cacheId) { if (is_array($tags) && !empty($tags)) { $this->_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $tags); } else { $this->_cache->clean(Zend_Cache::CLEANING_MODE_ALL); } } else { $cacheId = $this->_makeCacheId($cacheId, $cachePrefix); $this->_cache->remove($cacheId); } }
/** * Clear the page item cache. * * @param int $pageNumber * @return Zend_Paginator */ public function clearPageItemCache($pageNumber = null) { if (!$this->_cacheEnabled()) { return $this; } if (null === $pageNumber) { foreach (self::$_cache->getIdsMatchingTags(array($this->_getCacheInternalId())) as $id) { if (preg_match('|' . self::CACHE_TAG_PREFIX . "(\\d+)_.*|", $id, $page)) { self::$_cache->remove($this->_getCacheId($page[1])); } } } else { $cleanId = $this->_getCacheId($pageNumber); self::$_cache->remove($cleanId); } return $this; }
public function setSetting($key, $value) { $key = $this->_normalizeMagicProperty($key); // Array mode if (is_array($value)) { foreach ($value as $k => $v) { $this->setSetting($key . '.' . $k, $v); } } else { $path = explode('.', $key); $final = array_pop($path); $current =& $this->_settings; if (!empty($path)) { foreach ($path as $pathElement) { if (!isset($current[$pathElement]) || !is_array($current[$pathElement])) { $current[$pathElement] = array(); } $current =& $current[$pathElement]; } } // Delete if (isset($current[$final]) && null === $value) { $this->delete(array('name = ?' => $key)); $this->delete(array('name LIKE ?' => $key . '.%')); unset($current[$final]); } else { if (isset($current[$final])) { // Only if not the same? if ($current[$final] !== $value) { $this->update(array('value' => $value), array('name = ?' => $key)); } // Reselect? $current[$final] = $this->find($key)->current()->value; } else { $this->insert(array('name' => $key, 'value' => $value)); // Reselect? $current[$final] = $this->find($key)->current()->value; } } // Flush the cache $this->_cache->remove('settings'); } return $this; }
/** * Clear the page item cache. * * @param int $pageNumber * @return Zend_Paginator */ public function clearPageItemCache($pageNumber = null) { if (!$this->_cacheEnabled()) { return $this; } if (null === $pageNumber) { $cleanTags = self::CACHE_TAG_PREFIX; foreach (self::$_cache->getIds() as $id) { if (strpos($id, self::CACHE_TAG_PREFIX) !== false) { if (preg_match('|' . self::CACHE_TAG_PREFIX . "(\\d+)_.*|", $id, $page)) { self::$_cache->remove($this->_getCacheId($page[1])); } } } } else { $cleanId = $this->_getCacheId($pageNumber); self::$_cache->remove($cleanId); } return $this; }
/** * Get options * * @return array */ private function _getOptions() { if (!extension_loaded('apc')) { return $this->_makeOptions(); } //@todo GET SESSION/CACHE/LOAD Config include_once 'ZLayer/Cache.php'; include_once 'Zend/Cache.php'; include_once 'Zend/Cache/Core.php'; include_once 'Zend/Cache/Backend/Apc.php'; $configCache = new Zend_Cache_Core(array('automatic_serialization' => true)); $backend = new Zend_Cache_Backend_Apc(); $configCache->setBackend($backend); //$configMTime = filemtime($file); $cacheId = ZLayer_Cache::id("application"); $configCache->remove($cacheId); if ($configCache->test($cacheId) !== false) { return $configCache->load($cacheId, true); } else { $array = $this->_makeOptions(); $configCache->save($array, $cacheId, array(), null); return $array; } }
/** * Remove a cache file * * @param string $id * @param Zend_Cache_Core $coreCache * @return boolean */ public static function delete($id, Zend_Cache_Core $coreCache) { return $coreCache->remove($id); }
/** * */ public function remove($key) { $this->zendCache->remove(sha1($key)); }
/** * Reset cached DDL data from cache * if table name is null - reset all cached DDL data * * @param string $tableName * @param string $schemaName OPTIONAL * @return Varien_Db_Adapter_Pdo_Mysql */ public function resetDdlCache($tableName = null, $schemaName = null) { if (!$this->_isDdlCacheAllowed) { return $this; } if ($tableName === null) { $this->_ddlCache = array(); if ($this->_cacheAdapter instanceof Zend_Cache_Core) { $this->_cacheAdapter->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(self::DDL_CACHE_TAG)); } } else { $cacheKey = $this->_getTableName($tableName, $schemaName); $ddlTypes = array(self::DDL_DESCRIBE, self::DDL_CREATE, self::DDL_INDEX, self::DDL_FOREIGN_KEY); foreach ($ddlTypes as $ddlType) { unset($this->_ddlCache[$ddlType][$cacheKey]); } if ($this->_cacheAdapter instanceof Zend_Cache_Core) { foreach ($ddlTypes as $ddlType) { $cacheId = $this->_getCacheId($cacheKey, $ddlType); $this->_cacheAdapter->remove($cacheId); } } } return $this; }
function __unset($name) { parent::delete(array('key = ?' => $name)); $this->_cache->remove(__CLASS__ . $name); }
/** * * @param Zend_Cache_Core $persistentCache * @param string $class * @param string $method * @param string $cacheId */ protected function _purgePersistentCacheEntry(Zend_Cache_Core $persistentCache, $class, $method, $cacheId) { $cacheEntry = $this->_inMemoryCache[$class][$method][$cacheId]; if ($cacheEntry['usePersistentCache'] !== false) { $persistentCache->remove($this->getPersistentCacheId($class, $method, $cacheId, $cacheEntry['usePersistentCache'])); } }
/** * Remove cached data by identifier * * @param string $id * @return bool */ public function remove($id) { return $this->_frontend->remove($this->_id($id)); }
/** * */ public static function remove($id) { self::initCache(); return self::$_cache->remove($id); }
/** * Destroy Session - remove data from resource for * given session id * * @param string $id */ public function destroy($id) { $id = $this->_prefix . $id; return $this->_cache->remove($id); }
/** * Remove event - remove cache by id * * @param \Zend_EventManager_EventDescription $event * @return boolean */ public function remove(\Zend_EventManager_EventDescription $event) { return $this->cache->remove($this->_getIdentifier($event)); }
/** * Deletes a cache entry. * * @param string $id cache id * * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. */ protected function doDelete($id) { return $this->cache->remove(md5($id)); }
/** * {@inheritdoc} */ public function remove($identifier) { return $this->_frontend->remove($this->_unifyId($identifier)); }
/** * Remove cache * * @param string $id * @return Mage_Core_Model_App */ public function removeCache($id) { $this->_cache->remove($id); return $this; }
/** * Removes an object from the cache, if available. * * @param array $options An array of options which will be considered in buildId */ public function remove(array $options) { if (!$this->_cache) { return; } $this->_cache->remove($this->buildId($options)); }