Example #1
0
 /**
  * Reads the cache object from a file
  * @param zibo\library\filesystem\File $cacheFile File of the cache object
  * @return zibo\library\cache\CacheObject|null The read cache object or null
  */
 private function readCacheObject(File $cacheFile)
 {
     if (!$cacheFile->exists()) {
         return null;
     }
     try {
         if ($this->useLock) {
             $cacheFile->waitForUnlock();
         }
         $serializedValue = $cacheFile->read();
         $object = unserialize($serializedValue);
     } catch (Exception $exception) {
         $object = null;
     }
     if (!$object) {
         return null;
     }
     return $object;
 }
Example #2
0
 /**
  * Reads the cache object from a file
  * @param zibo\library\filesystem\File $cacheFile File of the cache object
  * @return zibo\library\cache\CacheObject|null The read cache object or null
  */
 private function readCacheObject(File $cacheFile)
 {
     if (!$cacheFile->exists()) {
         return null;
     }
     try {
         if ($this->useLock) {
             $cacheFile->waitForUnlock();
         }
         $serializedValue = $cacheFile->read();
         $object = unserialize($serializedValue);
     } catch (Exception $exception) {
         Zibo::getInstance()->runEvent(Zibo::EVENT_LOG, $exception->getMessage(), $exception->getTraceAsString(), 1);
         $object = null;
     }
     if (!$object) {
         return null;
     }
     return $object;
 }