PHP Class Psr7Middlewares\Middleware\Cache

Mostrar archivo Open project: oscarotero/psr7-middlewares

Public Methods

Method Description
__construct ( Psr\Cache\CacheItemPoolInterface $cache ) Set the psr-6 cache pool.
__invoke ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Execute the middleware.
cacheControl ( string | Micheh\Cache\Header\CacheControl $cacheControl ) : self Set a cache-control header to all responses.

Private Methods

Method Description
getCacheKey ( Psr\Http\Message\RequestInterface $request ) : string Returns the id used to cache a request.

Method Details

__construct() public method

Set the psr-6 cache pool.
public __construct ( Psr\Cache\CacheItemPoolInterface $cache )
$cache Psr\Cache\CacheItemPoolInterface

__invoke() public method

Execute the middleware.
public __invoke ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface
$next callable
return Psr\Http\Message\ResponseInterface

cacheControl() public method

Set a cache-control header to all responses.
public cacheControl ( string | Micheh\Cache\Header\CacheControl $cacheControl ) : self
$cacheControl string | Micheh\Cache\Header\CacheControl
return self