Exemple #1
0
 /**
  * Manages block storage
  *
  * @param string $data     Block content to store
  * @param string $id       Cache ID
  * @param array  $tags     Tags
  * @param mixed  $lifetime EOL
  *
  * @return bool
  */
 protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
 {
     if ($this->_saveBlock) {
         return parent::_saveCache($data, $id, $tags, $lifetime);
     }
     return false;
 }
Exemple #2
0
 /**
  * Redirect to content processing on new message
  *
  * @param string $content
  * @return bool
  */
 public function applyWithoutApp(&$content)
 {
     if ($this->_isNewMessageRecived()) {
         return false;
     }
     return parent::applyWithoutApp($content);
 }
 /**
  * Save data to cache storage. Store many block instances in one cache record depending on additional cache ids.
  *
  * @param string $data
  * @param string $id
  * @param array $tags
  * @param null|int $lifetime
  * @return Enterprise_PageCache_Model_Container_Advanced_Abstract
  */
 protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
 {
     $additionalCacheId = $this->_getAdditionalCacheId();
     if (!$additionalCacheId) {
         Mage::throwException(Mage::helper('enterprise_pagecache')->__('Additional id should not be empty'));
     }
     $tags[] = Enterprise_PageCache_Model_Processor::CACHE_TAG;
     if (is_null($lifetime)) {
         $lifetime = $this->_placeholder->getAttribute('cache_lifetime') ? $this->_placeholder->getAttribute('cache_lifetime') : false;
     }
     /**
      * Replace all occurrences of session_id with unique marker
      */
     Enterprise_PageCache_Helper_Url::replaceSid($data);
     $result = array();
     $cacheRecord = parent::_loadCache($id);
     if ($cacheRecord) {
         $cacheRecord = json_decode($cacheRecord, true);
         if ($cacheRecord) {
             $result = $cacheRecord;
         }
     }
     $result[$additionalCacheId] = $data;
     Enterprise_PageCache_Model_Cache::getCacheInstance()->save(json_encode($result), $id, $tags, $lifetime);
     return $this;
 }
 protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
 {
     if ($lifetime === null) {
         $lifetime = $this->_parseLifetime($this->_getLifetime());
     }
     if ($lifetime !== 'none') {
         return parent::_saveCache($data, $id, $tags, $lifetime);
     }
     return $this;
 }
 /**
  * Save data to cache storage. Store many block instances in one cache record depending on additional cache ids.
  *
  * @param string $data
  * @param string $id
  * @param array $tags
  * @param null|int $lifetime
  * @return Enterprise_PageCache_Model_Container_Advanced_Abstract
  */
 protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
 {
     $additionalCacheId = $this->_getAdditionalCacheId();
     if (!$additionalCacheId) {
         Mage::throwException(Mage::helper('enterprise_pagecache')->__('Additional id should not be empty'));
     }
     $tags[] = Enterprise_PageCache_Model_Processor::CACHE_TAG;
     $tags = array_merge($tags, $this->_getPlaceHolderBlock()->getCacheTags());
     if (is_null($lifetime)) {
         $lifetime = $this->_placeholder->getAttribute('cache_lifetime') ? $this->_placeholder->getAttribute('cache_lifetime') : false;
     }
     Enterprise_PageCache_Helper_Data::prepareContentPlaceholders($data);
     $result = array();
     $cacheRecord = parent::_loadCache($id);
     if ($cacheRecord) {
         $cacheRecord = json_decode($cacheRecord, true);
         if ($cacheRecord) {
             $result = $cacheRecord;
         }
     }
     $result[$additionalCacheId] = $data;
     Enterprise_PageCache_Model_Cache::getCacheInstance()->save(json_encode($result), $id, $tags, $lifetime);
     return $this;
 }
 /**
  * Load informational cache
  *
  * @return false|array
  */
 protected function _loadInfoCache()
 {
     $result = false;
     $data = array();
     $cacheRecord = Enterprise_PageCache_Model_Container_Abstract::_loadCache($this->_getCacheId());
     if ($cacheRecord) {
         $cacheRecord = json_decode($cacheRecord, true);
         if ($cacheRecord) {
             $data = $cacheRecord;
         }
     }
     if (array_key_exists($this->_getInfoCacheId(), $data)) {
         $result = $data[$this->_getInfoCacheId()];
     }
     return $result;
 }
 /**
  * Saves informational cache, containing parameters used to show lists.
  *
  * @return Enterprise_PageCache_Model_Container_CatalogProductItem
  */
 protected function _saveInfoCache()
 {
     $placeholderName = $this->_placeholder->getName();
     if (is_null(self::$_sharedInfoData[$placeholderName]['info'])) {
         return $this;
     }
     $data = array();
     $cacheRecord = Enterprise_PageCache_Model_Container_Abstract::_loadCache($this->_getCacheId());
     if ($cacheRecord) {
         $cacheRecord = json_decode($cacheRecord, true);
         if ($cacheRecord) {
             $data = $cacheRecord;
         }
     }
     $data[$this->_getInfoCacheId()] = self::$_sharedInfoData[$placeholderName]['info'];
     $data = json_encode($data);
     $tags = array(Enterprise_PageCache_Model_Processor::CACHE_TAG);
     $lifetime = $this->_placeholder->getAttribute('cache_lifetime');
     if (!$lifetime) {
         $lifetime = false;
     }
     Enterprise_PageCache_Model_Cache::getCacheInstance()->save($data, $this->_getCacheId(), $tags, $lifetime);
     return $this;
 }
 protected function _saveCache($data, $id, $tags = array(), $lifetime = 5)
 {
     parent::_saveCache($data, $id, $tags, $lifetime);
 }
 /**
  * Save data to cache storage and set cache lifetime equal with customer session lifetime
  *
  * @param string $data
  * @param string $id
  * @param array $tags
  */
 protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
 {
     $lifetime = Mage::getConfig()->getNode(Mage_Core_Model_Session_Abstract::XML_PATH_COOKIE_LIFETIME);
     return parent::_saveCache($data, $id, $tags, $lifetime);
 }