Class CachePlugin
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).
- Guzzle\Plugin\Cache\CachePlugin implements Symfony\Component\EventDispatcher\EventSubscriberInterface
public
|
#
__construct( array|
Construct a new CachePlugin. Cache options include the following: |
public static
array
|
|
public
|
#
onRequestBeforeSend(
Check if a response in cache will satisfy the request before sending |
public
|
|
public
|
|
public
null
|
#
onRequestException(
If possible, set a cache response on a cURL exception |
public
boolean
|
#
canResponseSatisfyRequest(
Check if a cache response satisfies a request's caching constraints |
public
boolean
|
#
canResponseSatisfyFailedRequest(
Check if a cache response satisfies a failed request's caching constraints |
public
|
|
protected
|
#
addResponseHeaders( string $cacheKey,
Add the plugin's headers to a response |
protected
|
$keyProvider |
|
#
Cache key provider |
protected
|
$revalidation |
|
#
Cache revalidation strategy |
protected
|
$canCache |
|
#
Object used to determine if a request can be cached |
protected
|
$storage |
|
#
$cache Object used to cache responses |
protected
boolean
|
$debugHeaders |
|
#
Whether to add debug headers to the response |