Documentation

DefaultCacheStorage
in package
implements CacheStorageInterface

Default cache storage implementation

Interfaces, Classes and Traits

CacheStorageInterface
Interface used to cache HTTP requests

Table of Contents

$cache  : CacheAdapterInterface
$defaultTtl  : int
$keyPrefix  : string
__construct()  : mixed
cache()  : mixed
Cache an HTTP request
delete()  : mixed
Deletes cache entries that match a request
fetch()  : null|Response
Get a Response from the cache for a request
purge()  : mixed
Purge all cache entries for a given URL
getBodyKey()  : string
Create a cache key for a response's body
getCacheKey()  : string
Hash a request URL into a string that returns cache metadata
persistHeaders()  : array<string|int, mixed>
Creates an array of cacheable and normalized message headers
requestsMatch()  : bool
Determines whether two Request HTTP header sets are non-varying

Properties

Methods

__construct()

public __construct(mixed $cache[, string $keyPrefix = '' ][, int $defaultTtl = 3600 ]) : mixed
Parameters
$cache : mixed

Cache used to store cache data

$keyPrefix : string = ''

Provide an optional key prefix to prefix on all cache keys

$defaultTtl : int = 3600

Default cache TTL

Return values
mixed

purge()

Purge all cache entries for a given URL

public purge(mixed $url) : mixed
Parameters
$url : mixed
Return values
mixed

requestsMatch()

Determines whether two Request HTTP header sets are non-varying

private requestsMatch(string $vary, array<string|int, mixed> $r1, array<string|int, mixed> $r2) : bool
Parameters
$vary : string

Response vary header

$r1 : array<string|int, mixed>

HTTP header array

$r2 : array<string|int, mixed>

HTTP header array

Return values
bool

Search results