Skip to content
Corex

WordPressCacheStore

Corex\Cache\WordPressCacheStore · class · Core layer

The cache CoreX actually uses (spec 078, FR-007/008/009). Two backings, one behaviour: the object cache when WordPress is using a persistent one, transients otherwise. Both are WordPress mechanisms, and neither is a fallback — the overwhelming majority of CoreX installs are shared hosting with transients, so that is the normal path and it has to be first-class. Namespaces are versioned rather than enumerated: forgetNamespace() moves a counter, so every key under it misses at once. Enumerating keys is impossible on some object caches and slow on the options table, and a version bump is atomic where a delete loop is not. Nothing here throws. A cache that raises turns a speed layer into an outage.

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”