本文整理汇总了PHP中Zend_Cache_Core::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Core::clean方法的具体用法?PHP Zend_Cache_Core::clean怎么用?PHP Zend_Cache_Core::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Cache_Core
的用法示例。
在下文中一共展示了Zend_Cache_Core::clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Should handle execution of the task, taking as much (optional) parameters as needed
*
* The parameters should be optional and failing to provide them should be handled by
* the task
*/
public function execute($text = null)
{
if ($this->cache instanceof \Zend_Cache_Core) {
$this->cache->clean(\Zend_Cache::CLEANING_MODE_ALL);
$this->getBatch()->addMessage($this->_('Cache cleaned'));
}
}
示例2: testClean
public function testClean()
{
$this->rediska->set('test', array('aaa', time(), null));
$reply = $this->cache->clean();
$this->assertTrue($reply);
$reply = $this->rediska->get('test');
$this->assertNull($reply);
}
示例3: clean
/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException Exception is thrown when non-supported cleaning mode is specified
*/
public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, array $tags = [])
{
// Cleaning modes 'old' and 'notMatchingTag' are prohibited as a trade off for decoration reliability
if (!in_array($mode, [\Zend_Cache::CLEANING_MODE_ALL, \Zend_Cache::CLEANING_MODE_MATCHING_TAG, \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG])) {
throw new \InvalidArgumentException("Magento cache frontend does not support the cleaning mode '{$mode}'.");
}
return $this->_frontend->clean($mode, $this->_unifyIds($tags));
}
示例4: 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);
}
}
示例5: afterFormValidationFor
/**
* Overrule this function for any activities you want to take place
* after the form has successfully been validated, but before any
* buttons are processed.
*
* @param int $step The current step
*/
protected function afterFormValidationFor($step)
{
if (3 == $step) {
$import = $this->loadImportData();
$model = $this->getModel();
$saves = array();
foreach ($model->getCol('exportCode') as $name => $exportCode) {
if (isset($this->formData[$name]) && $this->formData[$name]) {
$saves[] = array('gsu_id_survey' => $this->formData[$name], 'gsu_export_code' => $exportCode);
$import['surveyCodes'][$exportCode] = $this->formData[$name];
}
}
if ($saves) {
$sModel = new \MUtil_Model_TableModel('gems__surveys');
\Gems_Model::setChangeFieldsByPrefix($sModel, 'gus', $this->currentUser->getUserId());
$sModel->saveAll($saves);
$count = $sModel->getChanged();
if ($count == 0) {
$this->addMessage($this->_('No export code changed'));
} else {
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('surveys'));
$this->addMessage(sprintf($this->plural('%d export code changed', '%d export codes changed', $count), $count));
}
}
}
}
示例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: resetCache
/**
* 重置缓存对象
*
* @static
* @return boolean
*/
public static function resetCache()
{
if (null !== self::$_cache) {
return self::$_cache->clean();
}
return false;
}
示例8: flush
/**
* Clean cached data by specific tag
*
* @return bool
*/
public function flush()
{
Magento_Profiler::start('cache_flush', $this->_generateProfilerTags('flush'));
$res = $this->_frontend->clean();
Magento_Profiler::stop('cache_flush');
return $res;
}
示例9: testCleanAnyMatchingTag
/**
* @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);
}
示例10: clearCache
/**
* Clears all set cache data
*
* @return void
*/
public static function clearCache()
{
if (self::$_cacheTags) {
self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('Zend_Locale'));
} else {
self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL);
}
}
示例11: afterSave
/**
* Hook that allows actions when data was saved
*
* When not rerouted, the form will be populated afterwards
*
* @param int $changed The number of changed rows (0 or 1 usually, but can be more)
*/
protected function afterSave($changed)
{
if ($changed) {
// Clean cache on changes
if ($this->cacheTags && $this->cache instanceof \Zend_Cache_Core) {
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, (array) $this->cacheTags);
}
}
}
示例12: clean
/**
* Clear event - clear all cache by tags
*
* @param Zend_EventManager_EventDescription $event
*/
public function clean(\Zend_EventManager_EventDescription $event)
{
$params = $event->getParams();
$mode = \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG;
if (isset($params['mode'])) {
$mode = $params['mode'];
}
return $this->cache->clean($mode, $this->_getTags($event));
}
示例13: clearConfigCache
/**
* Clear search cache
*/
public function clearConfigCache()
{
$capabilities = $this->cache->getBackend()->getCapabilities();
if (!empty($capabilities['tags'])) {
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('Shopware_Config', 'Shopware_Plugin'));
} else {
$this->cache->clean();
}
}
示例14: performAction
/**
* Overrule this function if you want to perform a different
* action than deleting when the user choose 'yes'.
*/
protected function performAction()
{
$model = $this->getModel();
$model->save($this->saveData + $model->getFilter());
if ($this->cacheTags && $this->cache instanceof \Zend_Cache_Core) {
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, (array) $this->cacheTags);
}
$this->setAfterDeleteRoute();
}
示例15: afterSave
/**
* Hook that allows actions when data was saved
*
* When not rerouted, the form will be populated afterwards
*
* @param int $changed The number of changed rows (0 or 1 usually, but can be more)
*/
protected function afterSave($changed)
{
if ($this->trackEngine) {
$this->addMessage($this->_('Track merge finished'));
} else {
$this->addMessage($this->_('Track import finished'));
}
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('tracks'));
}