PHP Trait WhichBrowser\Cache

Show file Open project: whichbrowser/parser

Public Properties

Property Type Description
$cached boolean Was this result retrieve from the cache?

Public Methods

Method Description
setCache ( object $cache, integer $expires = 900 ) Enable caching of results

Private Methods

Method Description
analyseWithCache ( array | string $headers, $options = [] ) : boolean Retrieve the result from the cache, or analyse and store in the cache
applyCachedData ( array $data ) Apply cached data to the main Parser object
retrieveCachedData ( ) : array Retrieve the data that can be cached from the main Parser object

Method Details

setCache() public method

Enable caching of results
public setCache ( object $cache, integer $expires = 900 )
$cache object An PSR-6 cache pool (an object that implements Psr\Cache\CacheItemPoolInterface)
$expires integer Optional the number of seconds after which a cached item expires, default is 15 minutes

Property Details

$cached public property

Was this result retrieve from the cache?
public bool $cached
return boolean