Overview

Namespaces

  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
    • Tests
      • Batch
      • Cache
      • Common
        • Cache
        • Exception
      • Http
        • Curl
        • Exception
        • Message
          • Header
      • Inflection
      • Iterator
      • Log
      • Message
      • Mock
      • Parser
        • Cookie
        • Message
      • Parsers
        • UriTemplate
      • Plugin
        • Async
        • Backoff
        • Cache
        • Cookie
          • CookieJar
        • CurlAuth
        • ErrorResponse
        • History
        • Log
        • Md5
        • Mock
        • Oauth
        • Redirect
      • Service
        • Builder
        • Command
          • LocationVisitor
            • Request
            • Response
        • Description
        • Exception
        • Mock
          • Command
            • Sub
          • Model
        • Resource
      • Stream
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • VivaPayments
      • Message
  • PHP

Classes

  • CachePlugin
  • CallbackCanCacheStrategy
  • DefaultCacheKeyProvider
  • DefaultCacheStorage
  • DefaultCanCacheStrategy
  • DefaultRevalidation
  • DenyRevalidation
  • SkipRevalidation

Interfaces

  • CacheKeyProviderInterface
  • CacheStorageInterface
  • CanCacheStrategyInterface
  • RevalidationInterface
  • Overview
  • Namespace
  • Class
  • Tree

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
Namespace: Guzzle\Plugin\Cache
Located at src/Guzzle/Plugin/Cache/CachePlugin.php
Methods summary
public
# __construct( array|Guzzle\Cache\CacheAdapterInterface|Guzzle\Plugin\Cache\CacheStorageInterface $options = null )

Parameters

$options

Array of options for the cache plugin, cache adapter, or cache storage object. - CacheStorageInterface storage: Adapter used to cache responses - RevalidationInterface revalidation: Cache revalidation strategy - CanCacheInterface can_cache: Object used to determine if a request can be cached - bool auto_purge Set to true to automatically PURGE resources when non-idempotent requests are sent to a resource. Defaults to false.

Throws

InvalidArgumentException
if no cache is provided and Doctrine cache is not installed
public static
# getSubscribedEvents( )
public
# onRequestBeforeSend( Guzzle\Common\Event $event )

Check if a response in cache will satisfy the request before sending

Check if a response in cache will satisfy the request before sending

Parameters

$event
public
# onRequestSent( Guzzle\Common\Event $event )

If possible, store a response in cache after sending

If possible, store a response in cache after sending

Parameters

$event
public
# onRequestError( Guzzle\Common\Event $event )

If possible, return a cache response on an error

If possible, return a cache response on an error

Parameters

$event
public null
# onRequestException( Guzzle\Common\Event $event )

If possible, set a cache response on a cURL exception

If possible, set a cache response on a cURL exception

Parameters

$event

Returns

null
public boolean
# canResponseSatisfyRequest( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response )

Check if a cache response satisfies a request's caching constraints

Check if a cache response satisfies a request's caching constraints

Parameters

$request
Request to validate
$response
Response to validate

Returns

boolean
public boolean
# canResponseSatisfyFailedRequest( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response )

Check if a cache response satisfies a failed request's caching constraints

Check if a cache response satisfies a failed request's caching constraints

Parameters

$request
Request to validate
$response
Response to validate

Returns

boolean
public
# purge( string $url )

Purge all cache entries for a given URL

Purge all cache entries for a given URL

Parameters

$url
URL to purge
protected
# addResponseHeaders( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response )

Add the plugin's headers to a response

Add the plugin's headers to a response

Parameters

$request
Request
$response
Response to add headers to
Properties summary
protected Guzzle\Plugin\Cache\RevalidationInterface $revalidation

Cache revalidation strategy

Cache revalidation strategy

#
protected Guzzle\Plugin\Cache\CanCacheStrategyInterface $canCache

Object used to determine if a request can be cached

Object used to determine if a request can be cached

#
protected Guzzle\Plugin\Cache\CacheStorageInterface $storage

$cache Object used to cache responses

$cache Object used to cache responses

#
protected boolean $autoPurge
#
Omnipay Viva Payments Gateway Module API Documentation API documentation generated by ApiGen