Beispiel #1
0
 /**
  * Unlock controller action
  *
  * @return bool
  */
 public function unlockCurrentAction()
 {
     if (\Magelight\Cache\AdapterPool::getInstance()->getAdapter()->del($this->getLockKey())) {
         return true;
     }
     return false;
 }
Beispiel #2
0
 /**
  * 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;
 }
Beispiel #3
0
 /**
  * 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();
 }
Beispiel #4
0
 /**
  * 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;
 }
Beispiel #5
0
 /**
  * Get cache adapter instance
  *
  * @return \Magelight\Cache\AdapterAbstract
  */
 public function cache()
 {
     return \Magelight\Cache\AdapterPool::getInstance()->getAdapter($this->getCacheIndex());
 }