PHP Class Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy

It can be used to cache responses in spite of any cache related response headers, but it SHOULDN'T be used unless absolutely necessary, e.g. when accessing badly designed APIs without Cache control. Obviously, this follows no RFC :(.
Inheritance: extends PrivateCacheStrategy
Show file Open project: kevinrob/guzzle-cache-middleware

Protected Properties

Property Type Description
$ttl integer

Public Methods

Method Description
__construct ( Kevinrob\GuzzleCache\Storage\CacheStorageInterface $cache = null, $ttl )
cache ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )
fetch ( Psr\Http\Message\RequestInterface $request )

Protected Methods

Method Description
getCacheKey ( Psr\Http\Message\RequestInterface $request )
getCacheObject ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )

Method Details

__construct() public method

public __construct ( Kevinrob\GuzzleCache\Storage\CacheStorageInterface $cache = null, $ttl )
$cache Kevinrob\GuzzleCache\Storage\CacheStorageInterface

cache() public method

public cache ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface

fetch() public method

public fetch ( Psr\Http\Message\RequestInterface $request )
$request Psr\Http\Message\RequestInterface

getCacheKey() protected method

protected getCacheKey ( Psr\Http\Message\RequestInterface $request )
$request Psr\Http\Message\RequestInterface

getCacheObject() protected method

protected getCacheObject ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface

Property Details

$ttl protected property

protected int $ttl
return integer