Psr16ResponseCache
in package
implements
ResponseCache
FinalYes
Caches responses in any PSR-16 cache (Redis, APCu, files...). Needs psr/simple-cache.
Table of Contents
Interfaces
- ResponseCache
- Stores raw response bodies. Keys never contain an API key.
Properties
Methods
- __construct() : mixed
- get() : string|null
- put() : void
- key() : string
- PSR-16 keys may not contain {}()/\@: so the request is hashed.
Properties
$cache read-only
private
CacheInterface
$cache
$prefix read-only
private
string
$prefix
= 'thesportsdb.'
Methods
__construct()
public
__construct(CacheInterface $cache[, string $prefix = 'thesportsdb.' ]) : mixed
Parameters
- $cache : CacheInterface
- $prefix : string = 'thesportsdb.'
get()
public
get(string $key) : string|null
Parameters
- $key : string
Return values
string|nullput()
public
put(string $key, string $body, float $ttl) : void
Parameters
- $key : string
- $body : string
- $ttl : float
key()
PSR-16 keys may not contain {}()/\@: so the request is hashed.
private
key(string $key) : string
Parameters
- $key : string