php/WP_CLI/FileCache.php
public function has( $key, $ttl = null ) {
		if ( ! $this->enabled ) {
			return false;
		}

		$filename = $this->filename( $key );

		if ( ! file_exists( $filename ) ) {
			return false;
		}

		// use ttl param or global ttl
		if ( null === $ttl ) {
			$ttl = $this->ttl;
		} elseif ( $this->ttl > 0 ) {
			$ttl = min( (int) $ttl, $this->ttl );
		} else {
			$ttl = (int) $ttl;
		}

		//
		if ( $ttl > 0 && ( filemtime( $filename ) + $ttl ) < time() ) {
			if ( $this->ttl > 0 && $ttl >= $this->ttl ) {
				unlink( $filename );
			}
			return false;
		}

		return $filename;
	}
public function has( $key, $ttl = null ) {
		if ( ! $this->enabled ) {
			return false;
		}

		$filename = $this->filename( $key );

		if ( ! file_exists( $filename ) ) {
			return false;
		}

		// use ttl param or global ttl
		if ( null === $ttl ) {
			$ttl = $this->ttl;
		} elseif ( $this->ttl > 0 ) {
			$ttl = min( (int) $ttl, $this->ttl );
		} else {
			$ttl = (int) $ttl;
		}

		//
		if ( $ttl > 0 && ( filemtime( $filename ) + $ttl ) < time() ) {
			if ( $this->ttl > 0 && $ttl >= $this->ttl ) {
				unlink( $filename );
			}
			return false;
		}

		return $filename;
	}
public function has ( $ key , $ ttl = null ) { if ( ! $ this -> enabled ) { return false ; } $ filename = $ this -> filename ( $ key ) ; if ( ! file_exists ( $ filename ) ) { return false ; } // use ttl param or global ttl if ( null === $ ttl ) { $ ttl = $ this -> ttl ; } elseif ( $ this -> ttl > 0 ) { $ ttl = min ( ( int ) $ ttl , $ this -> ttl ) ; } else { $ ttl = ( int ) $ ttl ; } // if ( $ ttl > 0 && ( filemtime ( $ filename ) + $ ttl ) < time ( ) ) { if ( $ this -> ttl > 0 && $ ttl >= $ this -> ttl ) { unlink ( $ filename ) ; } return false ; } return $ filename ; }
Check if a file is in cache and return its filename

@param string $key cache key
@param int    $ttl time to live
@return bool|string filename or false
Check if a file is in cache and return its filename