mini\Cache\DatabaseCache class

Documentation

Database-backed PSR-16 SimpleCache implementation

Stores cache data in database with automatic garbage collection. Uses the 'mini_cache' table for storage.

IMPORTANT: Fetches DatabaseInterface from container on each access to ensure proper scoping in long-running applications (cache is Singleton, db is Scoped).

Inheritance

Implements: Psr\SimpleCache\CacheInterface

Properties (1)

private string $tableName

Methods (17)

Documentation missing

Get DatabaseInterface from container (fresh per request)

Ensure the cache table exists

Randomly trigger garbage collection (1 in 10,000 chance)

Remove expired cache entries

Validate cache key

Calculate expiration timestamp from TTL

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Get cache statistics for debugging

Manually trigger garbage collection

Source

src/Cache/DatabaseCache.php:18-268