示例#1
0
文件: Cache.php 项目: mage2pro/core
 /**
  * @param string $key
  * @return mixed|bool
  */
 public function loadDataComplex($key)
 {
     /** @var mixed|bool $result */
     $result = false;
     if ($this->isEnabled()) {
         /** @var string|bool $serialized */
         $serialized = $this->loadData($key);
         if (false !== $serialized) {
             $result = df_unserialize($serialized);
         }
     }
     return $result;
 }
示例#2
0
文件: O.php 项目: mage2pro/core
 /**
  * @param string $propertyName
  * @param string $cacheKey
  * @return void
  */
 private function cacheLoadProperty($propertyName, $cacheKey)
 {
     $cacheKey = $cacheKey . $propertyName;
     /** @var string|bool $propertyValueSerialized */
     $propertyValueSerialized = df_cache_load($cacheKey);
     if ($propertyValueSerialized) {
         /** @var mixed $propertyValue */
         /**
          * Обратите внимание,
          * что @see json_decode() в случае невозможности деколирования возвращает NULL,
          * а @see unserialize в случае невозможности деколирования возвращает FALSE.
          */
         $propertyValue = isset($this->_cachedPropertiesSimpleMap[$propertyName]) ? df_unserialize_simple($propertyValueSerialized) : df_ftn(df_unserialize($propertyValueSerialized));
         if (!is_null($propertyValue)) {
             $this->_cachedPropertiesLoaded[$propertyName] = true;
             $this->{$propertyName} = $propertyValue;
         }
     }
 }