$revalidation
$revalidation : \Guzzle\Plugin\Cache\RevalidationInterface
Plugin to enable the caching of GET and HEAD requests. Caching can be done on all requests passing through this plugin or only after retrieving resources with cacheable response headers.
This is a simple implementation of RFC 2616 and should be considered a private transparent proxy cache, meaning authorization and private data can be cached.
It also implements RFC 5861's stale-if-error
Cache-Control extension, allowing stale cache responses to be used
when an error is encountered (such as a 500 Internal Server Error
or DNS failure).
$revalidation : \Guzzle\Plugin\Cache\RevalidationInterface
$canCache : \Guzzle\Plugin\Cache\CanCacheStrategyInterface
$storage : \Guzzle\Plugin\Cache\CacheStorageInterface
__construct(array|\Guzzle\Cache\CacheAdapterInterface|\Guzzle\Plugin\Cache\CacheStorageInterface $options = null)
array|\Guzzle\Cache\CacheAdapterInterface|\Guzzle\Plugin\Cache\CacheStorageInterface | $options | Array of options for the cache plugin, cache adapter, or cache storage object.
|
if no cache is provided and Doctrine cache is not installed
getSubscribedEvents() : array
Returns an array of event names this subscriber wants to listen to.
The array keys are event names and the value can be:
For instance:
The event names to listen to
onRequestBeforeSend(\Guzzle\Common\Event $event)
Check if a response in cache will satisfy the request before sending
\Guzzle\Common\Event | $event |
onRequestSent(\Guzzle\Common\Event $event)
If possible, store a response in cache after sending
\Guzzle\Common\Event | $event |
onRequestError(\Guzzle\Common\Event $event)
If possible, return a cache response on an error
\Guzzle\Common\Event | $event |
onRequestException(\Guzzle\Common\Event $event) : null
If possible, set a cache response on a cURL exception
\Guzzle\Common\Event | $event |
canResponseSatisfyRequest(\Guzzle\Http\Message\RequestInterface $request, \Guzzle\Http\Message\Response $response) : boolean
Check if a cache response satisfies a request's caching constraints
\Guzzle\Http\Message\RequestInterface | $request | Request to validate |
\Guzzle\Http\Message\Response | $response | Response to validate |
canResponseSatisfyFailedRequest(\Guzzle\Http\Message\RequestInterface $request, \Guzzle\Http\Message\Response $response) : boolean
Check if a cache response satisfies a failed request's caching constraints
\Guzzle\Http\Message\RequestInterface | $request | Request to validate |
\Guzzle\Http\Message\Response | $response | Response to validate |
addResponseHeaders(\Guzzle\Http\Message\RequestInterface $request, \Guzzle\Http\Message\Response $response)
Add the plugin's headers to a response
\Guzzle\Http\Message\RequestInterface | $request | Request |
\Guzzle\Http\Message\Response | $response | Response to add headers to |