public function checkCache($id) { $cache = Mirasvit_Fpc_Model_Cache::getCacheInstance(); if ($cache->load($id)) { return true; } return false; }
public function load() { $cache = Mirasvit_Fpc_Model_Cache::getCacheInstance(); $content = $cache->load($this->getCacheId()); if ($content) { $data = unserialize($content); $this->setData($data); return $this; } return false; }
public static function getCacheInstance() { if (is_null(self::$_cache)) { $options = Mage::app()->getConfig()->getNode('global/fpc'); if (!$options) { self::$_cache = Mage::app()->getCacheInstance(); return self::$_cache; } $options = $options->asArray(); foreach (array('backend_options', 'slow_backend_options') as $tag) { if (!empty($options[$tag]['cache_dir'])) { self::$cacheDir = Mage::getBaseDir('var') . DS . $options[$tag]['cache_dir']; $options[$tag]['cache_dir'] = self::$cacheDir; Mage::app()->getConfig()->getOptions()->createDirIfNotExists($options[$tag]['cache_dir']); } } self::$_cache = Mage::getModel('core/cache', $options); } return self::$_cache; }
public function onStockItemSaveAfter(Varien_Event_Observer $observer) { if ($observer->getDataObject() && $observer->getDataObject()->getProductId()) { $productId = $observer->getDataObject()->getProductId(); Mirasvit_Fpc_Model_Cache::getCacheInstance()->clean('CATALOG_PRODUCT_' . $productId); } }
public function getCache() { return Mirasvit_Fpc_Model_Cache::getCacheInstance(); }
public function render(Varien_Object $row) { $cache = Mirasvit_Fpc_Model_Cache::getCacheInstance(); $cacheId = $row->getData('cache_id'); return $cache->load($cacheId) ? '<span class="grid-severity-notice"><span>In Cache</span></span>' : '<span class="grid-severity-major"><span>Pending</span></span>'; }
protected function _saveCache($data, $id, $tags = array(), $lifetime = null) { $tags[] = Mirasvit_Fpc_Model_Processor::CACHE_TAG; if (is_null($lifetime)) { $lifetime = $this->_definition['cache_lifetime'] ? $this->_definition['cache_lifetime'] : false; } if (!$lifetime) { $lifetime = Mage::getSingleton('fpc/config')->getLifetime(); } if ($data == '') { $data = ' '; } Mirasvit_Fpc_Model_Cache::getCacheInstance()->save($data, $id, $tags, $lifetime); return $this; }