Cmd/Ctrl + K

Cache

Annabel exposes PSR-16 cache stores through cache().

Usage

Use the default cache store through the helper for common read and write operations.

The helper also supports concise get/set forms:

Use cache() with no arguments when you need the underlying PSR-16 store.

Stores

Supported stores include:

  • array: in-memory cache for tests.
  • file: local filesystem cache.
  • redis: Redis-backed cache.

Use Redis or another shared store for multi-instance deployments.

Configuration

Cache stores live in config/cache.php.

The Redis store uses the PHP Redis extension unless a client object is configured directly.

Atomic add

The cache store supports add(), which writes only when the key does not already exist:

This is useful for simple single-store locks and idempotency guards.