Class Guzzle\Plugin\Cache\DefaultRevalidation

InheritanceGuzzle\Plugin\Cache\DefaultRevalidation
ImplementsGuzzle\Plugin\Cache\RevalidationInterface
SubclassesGuzzle\Plugin\Cache\DenyRevalidation, Guzzle\Plugin\Cache\SkipRevalidation

Default revalidation strategy

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
createRevalidationRequest() Creates a request to use for revalidation Guzzle\Plugin\Cache\DefaultRevalidation
handle200Response() Handles a 200 response response from revalidating. The server does not support validation, so use this response. Guzzle\Plugin\Cache\DefaultRevalidation
handle304Response() Handle a 304 response and ensure that it is still valid Guzzle\Plugin\Cache\DefaultRevalidation
handleBadResponse() Handles a bad response when attempting to revalidate Guzzle\Plugin\Cache\DefaultRevalidation

Property Details

$canCache protected property
$storage protected property

Cache object storing cache data

Method Details

__construct() public method

public void __construct ( Guzzle\Plugin\Cache\CacheStorageInterface $cache, Guzzle\Plugin\Cache\CanCacheStrategyInterface $canCache null )
$cache Guzzle\Plugin\Cache\CacheStorageInterface

Cache storage

$canCache Guzzle\Plugin\Cache\CanCacheStrategyInterface

Determines if a message can be cached

createRevalidationRequest() protected method

Creates a request to use for revalidation

protected Guzzle\Http\Message\RequestInterface createRevalidationRequest ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response )
$request Guzzle\Http\Message\RequestInterface

Request

$response Guzzle\Http\Message\Response

Response to revalidate

return Guzzle\Http\Message\RequestInterface

Returns a revalidation request

handle200Response() protected method

Handles a 200 response response from revalidating. The server does not support validation, so use this response.

protected bool handle200Response ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $validateResponse )
$request Guzzle\Http\Message\RequestInterface

Request that was sent

$validateResponse Guzzle\Http\Message\Response

Response received

return bool

Returns true if valid, false if invalid

handle304Response() protected method

Handle a 304 response and ensure that it is still valid

protected bool handle304Response ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $validateResponse, Guzzle\Http\Message\Response $response )
$request Guzzle\Http\Message\RequestInterface

Request that was sent

$validateResponse Guzzle\Http\Message\Response

Response received

$response Guzzle\Http\Message\Response

Original cached response

return bool

Returns true if valid, false if invalid

handleBadResponse() protected method

Handles a bad response when attempting to revalidate

protected void handleBadResponse ( Guzzle\Http\Exception\BadResponseException $e )
$e Guzzle\Http\Exception\BadResponseException

Exception encountered

throws Guzzle\Http\Exception\BadResponseException
revalidate() public method

public void revalidate ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response )
$request
$response
shouldRevalidate() public method

public void shouldRevalidate ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response )
$request
$response