本文整理汇总了PHP中Magento\Framework\Cache\FrontendInterface::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendInterface::clean方法的具体用法?PHP FrontendInterface::clean怎么用?PHP FrontendInterface::clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Cache\FrontendInterface
的用法示例。
在下文中一共展示了FrontendInterface::clean方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterSave
/**
* Update a "layout update link" if relevant data is provided
*
* @param \Magento\Widget\Model\Layout\Update|\Magento\Framework\Model\AbstractModel $object
* @return $this
*/
protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
{
$data = $object->getData();
if (isset($data['store_id']) && isset($data['theme_id'])) {
$this->getConnection()->insertOnDuplicate($this->getTable('layout_link'), ['store_id' => $data['store_id'], 'theme_id' => $data['theme_id'], 'layout_update_id' => $object->getId(), 'is_temporary' => (int) $object->getIsTemporary()]);
}
$this->_cache->clean();
return parent::_afterSave($object);
}
示例2: assignToStore
/**
* Assign theme to the stores
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param array $stores
* @param string $scope
* @return $this
*/
public function assignToStore($theme, array $stores = [], $scope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES)
{
$isReassigned = false;
$this->_unassignThemeFromStores($theme->getId(), $stores, $scope, $isReassigned);
if ($this->_storeManager->isSingleStoreMode()) {
$this->_assignThemeToDefaultScope($theme->getId(), $isReassigned);
} else {
$this->_assignThemeToStores($theme->getId(), $stores, $scope, $isReassigned);
}
if ($isReassigned) {
$this->_configCache->clean();
$this->_layoutCache->clean();
}
$this->_eventManager->dispatch('assign_theme_to_stores_after', ['stores' => $stores, 'scope' => $scope, 'theme' => $theme]);
return $this;
}
示例3: clear
/**
* Deletes all items in the pool.
*
* @return bool
* True if the pool was successfully cleared. False if there was an error.
*/
public function clear()
{
if (empty($this->tags)) {
return false;
}
return $this->cacheFrontend->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, $this->tags);
}
示例4: reinitStores
/**
* {@inheritdoc}
*/
public function reinitStores()
{
$this->currentStoreId = null;
$this->storeRepository->clean();
$this->websiteRepository->clean();
$this->groupRepository->clean();
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, [StoreResolver::CACHE_TAG]);
}
示例5: clean
/**
* Clean cached data by specific tag
*
* @param array $tags
* @return bool
*/
public function clean($tags = array())
{
if ($tags) {
$result = $this->_frontend->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, (array) $tags);
} else {
/** @deprecated special case of cleaning by empty tags is deprecated after 2.0.0.0-dev42 */
$result = false;
/** @var $cacheFrontend \Magento\Framework\Cache\FrontendInterface */
foreach ($this->_frontendPool as $cacheFrontend) {
if ($cacheFrontend->clean()) {
$result = true;
}
}
}
return $result;
}
示例6: initialize
/**
* Initialize interception config
*
* @param array $classDefinitions
* @return void
*/
public function initialize($classDefinitions = [])
{
$this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, [$this->_cacheId]);
$config = [];
foreach ($this->_scopeList->getAllScopes() as $scope) {
$config = array_replace_recursive($config, $this->_reader->read($scope));
}
unset($config['preferences']);
foreach ($config as $typeName => $typeConfig) {
if (!empty($typeConfig['plugins'])) {
$this->_intercepted[ltrim($typeName, '\\')] = true;
}
}
foreach ($config as $typeName => $typeConfig) {
$this->hasPlugins($typeName);
}
foreach ($classDefinitions as $class) {
$this->hasPlugins($class);
}
$this->_cache->save(serialize($this->_intercepted), $this->_cacheId);
}
示例7: _saveAdvanced
/**
* Advanced save procedure
*
* @return void
*/
protected function _saveAdvanced()
{
$this->_cache->clean();
}
示例8:
function it_does_not_clear_cache_if_no_tags_specified_to_prevent_full_cache_flush()
{
$this->cacheFrontend->clean(Argument::any(), Argument::any())->shouldNotBeCalled();
$this->beConstructedWith($this->cacheItemFactory, $this->cacheFrontend, 'prefix_', []);
$this->clear()->shouldReturn(false);
}
示例9: resetDdlCache
/**
* Reset cached DDL data from cache
* if table name is null - reset all cached DDL data
*
* @param string $tableName
* @param string $schemaName OPTIONAL
* @return $this
*/
public function resetDdlCache($tableName = null, $schemaName = null)
{
if (!$this->_isDdlCacheAllowed) {
return $this;
}
if ($tableName === null) {
$this->_ddlCache = array();
if ($this->_cacheAdapter) {
$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) {
foreach ($ddlTypes as $ddlType) {
$cacheId = $this->_getCacheId($cacheKey, $ddlType);
$this->_cacheAdapter->remove($cacheId);
}
}
}
return $this;
}
示例10: clean
/**
* Clear cache of all scopes
*
* @return void
*/
public function clean()
{
$this->_scopes = [];
$this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, [self::CACHE_TAG]);
}
示例11: _afterSave
/**
* Process role after saving
*
* @param \Magento\Framework\Model\AbstractModel $role
* @return $this
*/
protected function _afterSave(\Magento\Framework\Model\AbstractModel $role)
{
$this->_updateRoleUsersAcl($role);
$this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(\Magento\Backend\Block\Menu::CACHE_TAGS));
return $this;
}