Skip to content
Corex

ArrayCacheStore

Corex\Cache\ArrayCacheStore · class · Core layer

A cache that lives for one request, for tests and for anything that must not depend on WordPress. Deterministic on purpose: expiry is evaluated against an injectable clock, so a test for “this expires after a minute” is a fact rather than a sleep(61).

get(string $namespace, string $key, mixed $default): mixed

Section titled “get(string $namespace, string $key, mixed $default): mixed”

put(string $namespace, string $key, mixed $value, int $ttl): bool

Section titled “put(string $namespace, string $key, mixed $value, int $ttl): bool”

forget(string $namespace, string $key): bool

Section titled “forget(string $namespace, string $key): bool”

remember(string $namespace, string $key, int $ttl, callable $compute): mixed

Section titled “remember(string $namespace, string $key, int $ttl, callable $compute): mixed”