getBackend example

/** * Clear cache action * * @throws Zend_Cache_Exception */
    public function clearCacheAction()
    {
        $cache = $this->Request()->getPost('cache', []);

        $cacheInstance = $this->container->get('cache');

        $capabilities = $cacheInstance->getBackend()->getCapabilities();

        if (empty($capabilities['tags'])) {
            if ($cache['config'] === 'on' || $cache['template'] === 'on') {
                $cacheInstance->clean();
            }
        } else {
            $tags = [];
            if ($cache['config'] === 'on' || $cache['backend'] === 'on') {
                $tags[] = CacheManager::ITEM_TAG_CONFIG;
                $tags[] = CacheManager::ITEM_TAG_PLUGIN;
            }
            
$sql = 'DELETE v FROM s_core_config_values v JOIN s_core_config_elements e ON e.id = v.element_id WHERE `name` LIKE "fuzzysearchlastupdate"';
        $this->db->executeQuery($sql);
    }

    /** * 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,
                [
                    self::ITEM_TAG_CONFIG,
                    self::ITEM_TAG_PLUGIN,
                ]
            );
        } else {
            $this->cache->clean();
        }
    }

    abstract public function toString();

    /** * Internal method to check if the given cache supports tags * * @param Zend_Cache $cache */
    private static function _getTagSupportForCache()
    {
        $backend = self::$_cache->getBackend();
        if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) {
            $cacheOptions = $backend->getCapabilities();
            self::$_cacheTags = $cacheOptions['tags'];
        } else {
            self::$_cacheTags = false;
        }

        return self::$_cacheTags;
    }
}
/** * Clears a given cache info item. This method maintains compatibility with the odl cache module's behaviour. * * @param string $cache * * @throws NotFoundException * @throws Zend_Cache_Exception */
    protected function clearCache($cache)
    {
        $capabilities = $this->cache->getBackend()->getCapabilities();

        if ($cache === 'all') {
            $this->cache->clean();

            $this->cacheManager->clearHttpCache();
            $this->cacheManager->clearConfigCache();
            $this->cacheManager->clearTemplateCache();
            $this->cacheManager->clearProxyCache();
            $this->cacheManager->clearSearchCache();
            $this->cacheManager->clearOpCache();

            
return $offset;
    }

    /** * Internal method to check if the given cache supports tags * * @param Zend_Cache $cache */
    protected static function _getTagSupportForCache()
    {
        $backend = self::$_cache->getBackend();
        if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) {
            $cacheOptions = $backend->getCapabilities();
            self::$_cacheTags = $cacheOptions['tags'];
        } else {
            self::$_cacheTags = false;
        }

        return self::$_cacheTags;
    }
}
return (string) $locale;
    }

    /** * Internal method to check if the given cache supports tags * * @param Zend_Cache $cache */
    private static function _getTagSupportForCache()
    {
        $backend = self::$_cache->getBackend();
        if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) {
            $cacheOptions = $backend->getCapabilities();
            self::$_cacheTags = $cacheOptions['tags'];
        } else {
            self::$_cacheTags = false;
        }

        return self::$_cacheTags;
    }
}
Home | Imprint | This part of the site doesn't use cookies.