Cache/Adapters/FileCacheNativeFormatAbstract.php
/**
   * Reads a resource from the cache
   * 
   * @param string $cacheFilePath
   * @return string|false false if not readable
   */
Reads a resource from the cache

@param string $cacheFilePath
@return string|false false if not readable
Reads a resource from the cache @param string $cacheFilePath @return string|false false if not readable
public static function read($cacheFilePath) {
    if (!is_readable($cacheFilePath)) {
      return false;
    }
    $content = file_get_contents($cacheFilePath); 
    $matches = [];
    $commentedTimestamp = strtok($content, "\n");
    preg_match('~([\d]+)~', $commentedTimestamp, $matches);
    $dataArray = [
      'expires' => !empty($matches[1]) ? $matches[1] : 1,
      'content' => substr($content, strlen($commentedTimestamp . "\n"))
    ];
    $expirationCallback = function() use ($cacheFilePath) {
      self::delete($cacheFilePath);
    };
    return self::getContent($dataArray, $expirationCallback);
  }
public static function read ( $ cacheFilePath ) { if ( ! is_readable ( $ cacheFilePath ) ) { return false ; } $ content = file_get_contents ( $ cacheFilePath ) ; $ matches = [ ] ; $ commentedTimestamp = strtok ( $ content , " \n " ) ; preg_match ( '~([\d]+)~' , $ commentedTimestamp , $ matches ) ; $ dataArray = [ 'expires' => ! empty ( $ matches [ 1 ] ) ? $ matches [ 1 ] : 1 , 'content' => substr ( $ content , strlen ( $ commentedTimestamp . " \n " ) ) ] ; $ expirationCallback = function ( ) use ( $ cacheFilePath ) { self :: delete ( $ cacheFilePath ) ; } ; return self :: getContent ( $ dataArray , $ expirationCallback ) ; }
Reads a resource from the cache
Reads a resource from the cache