mini\Mini\ApcuDrivers\ArrayApcuDriver
class
Documentation
ArrayApcuDriver - Simple in-memory APCu polyfill using static array
Provides APCu-compatible caching when neither APCu extension nor Swoole is available. Data is stored in a static array and persists only for the lifetime of the PHP process.
Limitations:
- Not shared between PHP-FPM workers or processes
- Cleared on each request in PHP-FPM (but persists in CLI/long-running processes)
- No memory limits (can grow unbounded)
- TTL cleanup only happens on access (lazy expiration)
Best used as a fallback or for testing when real APCu is unavailable.
Inheritance
Implements:
mini\Mini\ApcuDrivers\ApcuDriverInterface
Uses Traits:
mini\Mini\ApcuDrivers\ApcuDriverTrait
Properties (1)
array $data
In-memory storage: key => payload
Methods (27)
Fetch raw payload from static array.
Atomic "add if not exists" (SETNX) - single-threaded, so no actual locking needed.
Unconditional overwrite (SET).
Delete a key.
apcu_cache_info(): return basic stats about the array cache.
apcu_sma_info(): no real allocator, return stub.
apcu_clear_cache(): wipe the static array.
apcu_enabled(): this driver is always enabled (no dependencies).
Encode a value and its expiry into a payload string.
Decode payload into value + expiry.
Compute logical expiry from TTL.
Convert logical expiry to backend TTL.
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Probabilistic garbage collection - randomly triggers on write operations.
apcu_fetch
apcu_add
apcu_store
apcu_delete
apcu_exists
apcu_entry
apcu_cas
apcu_inc
apcu_dec
apcu_key_info (minimal)