original_string: public function isCacheValid($id, $tag = null)
      {
          assert('is_string($id)');
          assert('is_null($tag) || is_string($tag)');
  
          $cacheFile = strval($this->cacheDirectory).'/'.$id;
          if (!file_exists($cacheFile)) {
              return false;
          }
  
          $expireFile = $cacheFile.'.expire';
          if (!file_exists($expireFile)) {
              return false;
          }
  
          $expireData = @file_get_contents($expireFile);
          if ($expireData === false) {
              return false;
          }
  
          $expireData = explode(':', $expireData, 2);
  
          $expireTime = intval($expireData[0]);
          if ($expireTime <= time()) {
              return false;
          }
  
          if (count($expireData) === 1) {
              $expireTag = null;
          } else {
              $expireTag = $expireData[1];
          }
          if ($expireTag !== $tag) {
              return false;
          }
  
          return true;
      }
code: public function isCacheValid($id, $tag = null)
      {
          assert('is_string($id)');
          assert('is_null($tag) || is_string($tag)');
  
          $cacheFile = strval($this->cacheDirectory).'/'.$id;
          if (!file_exists($cacheFile)) {
              return false;
          }
  
          $expireFile = $cacheFile.'.expire';
          if (!file_exists($expireFile)) {
              return false;
          }
  
          $expireData = @file_get_contents($expireFile);
          if ($expireData === false) {
              return false;
          }
  
          $expireData = explode(':', $expireData, 2);
  
          $expireTime = intval($expireData[0]);
          if ($expireTime <= time()) {
              return false;
          }
  
          if (count($expireData) === 1) {
              $expireTag = null;
          } else {
              $expireTag = $expireData[1];
          }
          if ($expireTag !== $tag) {
              return false;
          }
  
          return true;
      }
code_tokens: public function isCacheValid ( $ id , $ tag = null ) { assert ( 'is_string($id)' ) ; assert ( 'is_null($tag) || is_string($tag)' ) ; $ cacheFile = strval ( $ this -> cacheDirectory ) . '/' . $ id ; if ( ! file_exists ( $ cacheFile ) ) { return false ; } $ expireFile = $ cacheFile . '.expire' ; if ( ! file_exists ( $ expireFile ) ) { return false ; } $ expireData = @ file_get_contents ( $ expireFile ) ; if ( $ expireData === false ) { return false ; } $ expireData = explode ( ':' , $ expireData , 2 ) ; $ expireTime = intval ( $ expireData [ 0 ] ) ; if ( $ expireTime <= time ( ) ) { return false ; } if ( count ( $ expireData ) === 1 ) { $ expireTag = null ; } else { $ expireTag = $ expireData [ 1 ] ; } if ( $ expireTag !== $ tag ) { return false ; } return true ; }
docstring: Check validity of cached data.
  
  @param string $id  The identifier of this data.
  @param string $tag  The tag that was passed to addCacheItem.
  @return bool  TRUE if the data is valid, FALSE if not.
docstring_tokens: Check validity of cached data .