PHP Класс Kevinrob\GuzzleCache\CacheMiddleware

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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 )

Защищенные методы

Метод Описание
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

Описание методов

__construct() публичный Метод

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

__invoke() публичный Метод

public __invoke ( callable $handler ) : callable
$handler callable
Результат callable

addReValidationRequest() защищенный Метод

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
Результат boolean if added

addToCache() защищенный статический Метод

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
Результат Psr\Http\Message\ResponseInterface

getCacheStorage() публичный Метод

public getCacheStorage ( ) : Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
Результат Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface

getHttpMethods() публичный Метод

public getHttpMethods ( )

getMiddleware() публичный статический Метод

Устаревший: Use constructor => `new CacheMiddleware()`
public static getMiddleware ( Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface $cacheStorage = null ) : CacheMiddleware
$cacheStorage Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface
Результат CacheMiddleware the Middleware for Guzzle HandlerStack

getRequestWithReValidationHeader() защищенный статический Метод

protected static getRequestWithReValidationHeader ( Psr\Http\Message\RequestInterface $request, CacheEntry $cacheEntry ) : Psr\Http\Message\RequestInterface
$request Psr\Http\Message\RequestInterface
$cacheEntry CacheEntry
Результат Psr\Http\Message\RequestInterface

getStaleResponse() защищенный статический Метод

protected static getStaleResponse ( CacheEntry $cacheEntry = null ) : null | Psr\Http\Message\ResponseInterface
$cacheEntry CacheEntry
Результат null | Psr\Http\Message\ResponseInterface

purgeReValidation() публичный Метод

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

setCacheStorage() публичный Метод

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

setClient() публичный Метод

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

setHttpMethods() публичный Метод

public setHttpMethods ( array $methods )
$methods array

Описание свойств

$cacheStorage защищенное свойство

protected CacheStrategyInterface,Kevinrob\GuzzleCache\Strategy $cacheStorage
Результат Kevinrob\GuzzleCache\Strategy\CacheStrategyInterface

$client защищенное свойство

protected Client,GuzzleHttp $client
Результат GuzzleHttp\Client

$httpMethods защищенное свойство

List of allowed HTTP methods to cache Key = method name (upscaling) Value = true.
protected array $httpMethods
Результат array

$waitingRevalidate защищенное свойство

of Promise
protected $waitingRevalidate