PHP 클래스 Kevinrob\GuzzleCache\CacheMiddleware

파일 보기 프로젝트 열기: kevinrob/guzzle-cache-middleware 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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