本文整理汇总了PHP中Zend_Cache_Core::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Core::remove方法的具体用法?PHP Zend_Cache_Core::remove怎么用?PHP Zend_Cache_Core::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Cache_Core
的用法示例。
在下文中一共展示了Zend_Cache_Core::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemove
public function testRemove()
{
$this->rediska->set('test', array('aaa', time(), null));
$this->cache->remove('test');
$reply = $this->rediska->get('test');
$this->assertNull($reply);
}
示例2: _deleteCache
/**
* 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');
}
}
示例3: testRemove
/**
*
* @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);
}
示例4: removeByPartialId
/**
* @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;
}
示例5: removeAclsCache
/**
* 清除权限关系缓存
*
* @return boolean
*/
public function removeAclsCache()
{
if (null !== self::$_cache) {
return self::$_cache->remove('acl');
}
return true;
}
示例6: _prepareAcl
/**
* @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;
}
示例7: remove
/**
* 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;
}
示例8: deleteSessionFromSource
/**
* 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));
}
}
示例9: invalidateCache
/**
* 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;
}
示例10: __destruct
/**
* 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);
}
}
示例11: remove
/**
* 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;
}
示例12: getInstance
/**
* 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;
}
示例13: clean
/**
* 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);
}
}
示例14: clearPageItemCache
/**
* 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;
}
示例15: setSetting
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;
}