InMemoryResponseCache
in package
implements
ResponseCache, Countable
FinalYes
A bounded, per-process LRU cache with per-entry expiry.
Table of Contents
Interfaces
- ResponseCache
- Stores raw response bodies. Keys never contain an API key.
- Countable
Properties
- $clock : callable(): float
- $entries : array<string, array{string, float}>
- $maxEntries : int
Methods
- __construct() : mixed
- clear() : void
- count() : int
- get() : string|null
- keys() : array<int, string>
- put() : void
Properties
$clock read-only
private
callable(): float
$clock
$entries
private
array<string, array{string, float}>
$entries
= []
$maxEntries read-only
private
int
$maxEntries
= 1000
Methods
__construct()
public
__construct([int $maxEntries = 1000 ][, callable(): float|null $clock = null ]) : mixed
Parameters
- $maxEntries : int = 1000
- $clock : callable(): float|null = null
clear()
public
clear() : void
count()
public
count() : int
Return values
intget()
public
get(string $key) : string|null
Parameters
- $key : string
Return values
string|nullkeys()
public
keys() : array<int, string>
Return values
array<int, string>put()
public
put(string $key, string $body, float $ttl) : void
Parameters
- $key : string
- $body : string
- $ttl : float