class ResponseCache

Constants

MAX_TTL_MS

Methods

__construct(string|null $store = null, string|null $for = null)

Create a response cache for the given store and private scope.

array
remember(Method $method, Transport $transport, Closure $fetch)

Retrieve a cached response or remember an eligible server result.

void
forget(Method $method, Transport $transport)

Forget both cache scopes for a request whose response is stale.

bool
cacheable(string $method, array $params)

Determine whether the request permits response caching.

string
key(array $recipe, string $method, array $params, CacheScope $scope)

Build a cache key for the endpoint, request and scope.

string
hash(mixed $value)

Hash cache inputs, which may include credentials.

Details

at line 22
__construct(string|null $store = null, string|null $for = null)

Create a response cache for the given store and private scope.

Parameters

string|null $store
string|null $for

at line 35
array remember(Method $method, Transport $transport, Closure $fetch)

Retrieve a cached response or remember an eligible server result.

Parameters

Method $method
Transport $transport
Closure $fetch

Return Value

array

at line 81
void forget(Method $method, Transport $transport)

Forget both cache scopes for a request whose response is stale.

Parameters

Method $method
Transport $transport

Return Value

void

at line 97
protected bool cacheable(string $method, array $params)

Determine whether the request permits response caching.

Parameters

string $method
array $params

Return Value

bool

at line 111
protected string key(array $recipe, string $method, array $params, CacheScope $scope)

Build a cache key for the endpoint, request and scope.

Parameters

array $recipe
string $method
array $params
CacheScope $scope

Return Value

string

at line 127
protected string hash(mixed $value)

Hash cache inputs, which may include credentials.

Parameters

mixed $value

Return Value

string