PHP Class Kevinrob\GuzzleCache\CacheMiddleware

Afficher le fichier Open project: kevinrob/guzzle-cache-middleware Class Usage Examples

Protected Properties

Свойство Type Description
$cacheStorage Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
$client GuzzleHttp\Client
$httpMethods array List of allowed HTTP methods to cache Key = method name (upscaling) Value = true.
$waitingRevalidate of Promise

Méthodes publiques

Méthode Description
__construct ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cacheStrategy = null )
__invoke ( callable $handler ) : callable
getCacheStorage ( ) : Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
getHttpMethods ( )
getMiddleware ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cacheStorage = null ) : CacheMiddleware
purgeReValidation ( ) Will be called at the end of the script.
setCacheStorage ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cacheStorage )
setClient ( Client $client )
setHttpMethods ( array $methods )

Méthodes protégées

Méthode Description
addReValidationRequest ( Psr\Http\Message\RequestInterface $request, Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface &$cacheStorage, CacheEntry $cacheEntry ) : boolean
addToCache ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cache, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, boolean $update = false ) : Psr\Http\Message\ResponseInterface
getRequestWithReValidationHeader ( Psr\Http\Message\RequestInterface $request, CacheEntry $cacheEntry ) : Psr\Http\Message\RequestInterface
getStaleResponse ( CacheEntry $cacheEntry = null ) : null | Psr\Http\Message\ResponseInterface

Method Details

__construct() public méthode

public __construct ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cacheStrategy = null )
$cacheStrategy Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface

__invoke() public méthode

public __invoke ( callable $handler ) : callable
$handler callable
Résultat callable

addReValidationRequest() protected méthode

protected addReValidationRequest ( Psr\Http\Message\RequestInterface $request, Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface &$cacheStorage, CacheEntry $cacheEntry ) : boolean
$request Psr\Http\Message\RequestInterface
$cacheStorage Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
$cacheEntry CacheEntry
Résultat boolean if added

addToCache() protected static méthode

protected static addToCache ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cache, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, boolean $update = false ) : Psr\Http\Message\ResponseInterface
$cache Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface
$update boolean cache
Résultat Psr\Http\Message\ResponseInterface

getCacheStorage() public méthode

public getCacheStorage ( ) : Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
Résultat Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface

getHttpMethods() public méthode

public getHttpMethods ( )

getMiddleware() public static méthode

Deprecation: Use constructor => `new CacheMiddleware()`
public static getMiddleware ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cacheStorage = null ) : CacheMiddleware
$cacheStorage Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
Résultat CacheMiddleware the Middleware for Guzzle HandlerStack

getRequestWithReValidationHeader() protected static méthode

protected static getRequestWithReValidationHeader ( Psr\Http\Message\RequestInterface $request, CacheEntry $cacheEntry ) : Psr\Http\Message\RequestInterface
$request Psr\Http\Message\RequestInterface
$cacheEntry CacheEntry
Résultat Psr\Http\Message\RequestInterface

getStaleResponse() protected static méthode

protected static getStaleResponse ( CacheEntry $cacheEntry = null ) : null | Psr\Http\Message\ResponseInterface
$cacheEntry CacheEntry
Résultat null | Psr\Http\Message\ResponseInterface

purgeReValidation() public méthode

Will be called at the end of the script.
public purgeReValidation ( )

setCacheStorage() public méthode

public setCacheStorage ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cacheStorage )
$cacheStorage Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface

setClient() public méthode

public setClient ( Client $client )
$client GuzzleHttp\Client

setHttpMethods() public méthode

public setHttpMethods ( array $methods )
$methods array

Property Details

$cacheStorage protected_oe property

protected CacheStrategyInterface,Kevinrob\GuzzleCache\Strategy $cacheStorage
Résultat Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface

$client protected_oe property

protected Client,GuzzleHttp $client
Résultat GuzzleHttp\Client

$httpMethods protected_oe property

List of allowed HTTP methods to cache Key = method name (upscaling) Value = true.
protected array $httpMethods
Résultat array

$waitingRevalidate protected_oe property

of Promise
protected $waitingRevalidate