示例#1
0
 /**
  * @param $id
  * @param bool $doNotTestCacheValidity
  * @return void
  */
 public function load($id, $doNotTestCacheValidity = false)
 {
     if (!$doNotTestCacheValidity) {
         $this->checkCacheConsistency();
     }
     return parent::load($id, $doNotTestCacheValidity);
 }
 public function load($id, $doNotTestCacheValidity = false)
 {
     $id = $this->_processId($id);
     try {
         return parent::load($id, $doNotTestCacheValidity);
     } catch (ErrorException $e) {
         if ($e->getSeverity() == E_NOTICE) {
             $e = new Kwf_Exception_Other($e);
             $e->logOrThrow();
             return false;
         }
         throw $e;
     }
 }
 public function load($id, $doNotTestCacheValidity = false)
 {
     return parent::load($this->_makeId($id), $doNotTestCacheValidity);
 }
 /**
  * Load data from memcached, glue from several chunks if it was splitted upon save.
  *
  * @param string $id                     @see Zend_Cache_Backend_Memcached::load()
  * @param bool   $doNotTestCacheValidity @see Zend_Cache_Backend_Memcached::load()
  * @return bool|false|string
  */
 public function load($id, $doNotTestCacheValidity = false)
 {
     $data = parent::load($id, $doNotTestCacheValidity);
     if (is_string($data) && substr($data, 0, strlen(self::CODE_WORD)) == self::CODE_WORD) {
         // Seems we've got chunked data
         $arr = explode('|', $data);
         $chunks = isset($arr[1]) ? $arr[1] : false;
         $chunkData = array();
         if ($chunks && is_numeric($chunks)) {
             for ($i = 0; $i < $chunks; $i++) {
                 $chunk = parent::load($this->_getChunkId($id, $i), $doNotTestCacheValidity);
                 if (false === $chunk) {
                     // Some chunk in chain was not found, we can not glue-up the data:
                     // clean the mess and return nothing
                     $this->_cleanTheMess($id, $chunks);
                     return false;
                 }
                 $chunkData[] = $chunk;
             }
             return implode('', $chunkData);
         }
     }
     // Data has not been splitted to chunks on save
     return $data;
 }
示例#5
0
 private function loadSliced($id, $slicesAmount)
 {
     //load all slices
     $slicedData = "";
     for ($i = 0; $i < $slicesAmount; $i++) {
         $sliceKey = $id . "_slice_" . $i;
         $slice = parent::load($sliceKey);
         if (!$slice) {
             Logger::debug("Error getting slice #" . $i . " for key " . $id . " (" . $sliceKey . ")");
             return false;
         } else {
             Logger::debug("Successfully got slice #" . $i . " for key " . $id . " (" . $sliceKey . ")");
             $slicedData .= $slice;
         }
     }
     Logger::debug("Successfully got sliced data for key " . $id);
     return $slicedData;
 }