/** * Unlock controller action * * @return bool */ public function unlockCurrentAction() { if (\Magelight\Cache\AdapterPool::getInstance()->getAdapter()->del($this->getLockKey())) { return true; } return false; }
/** * Flush all application caches * * @return App */ public function flushAllCache() { $config = \Magelight\Config::getInstance()->getConfig('global/cache'); foreach ($config->children() as $index => $cache) { $adapters[] = \Magelight\Cache\AdapterPool::getInstance()->getAdapter($index)->clear(); } return $this; }
/** * Set up before test */ public function setUp() { $this->configMock = $this->getMock(\Magelight\Config::class, [], [], '', false); \Magelight\Config::forgeMock($this->configMock); $this->adapterPool = \Magelight\Cache\AdapterPool::getInstance(); }
/** * Cleanup images cache * * @return Captcha */ public function cleanup() { if (isset($this->save_path)) { $files = glob(trim($this->save_path, '\\/') . DS . '*captcha.jpg'); foreach ($files as $file) { if (!\Magelight\Cache\AdapterPool::getInstance()->getAdapter()->get(realpath($file), false)) { unlink($file); } } } return $this; }
/** * Get cache adapter instance * * @return \Magelight\Cache\AdapterAbstract */ public function cache() { return \Magelight\Cache\AdapterPool::getInstance()->getAdapter($this->getCacheIndex()); }