// the find
laruence/yac
A fast, lock-free, shared memory user data cache for PHP
Yac is a PHP extension that puts a shared memory cache in front of your PHP processes — no network round-trips, no Redis, no Memcached daemon. It's lock-free by design and lives in the same shared memory segment all worker processes can read. Aimed at high-concurrency PHP-FPM setups where APC's per-process cache wastes memory and a remote cache adds latency.
Lock-free reads are genuinely fast — there's no mutex to contend on under heavy read load, which is where most caches become a bottleneck. Shared memory across FPM workers means you populate a key once and all 50 workers benefit immediately, unlike APC which silos per process. Multiple serializer backends (igbinary, msgpack, json) give you real control over payload size and speed rather than forcing PHP's native serialize. The partial CRC trick for integrity checking is a reasonable engineering tradeoff — fast enough to not negate the cache benefit.
The lockless design has a real cost the README buries in a note: concurrent writers on the same key can silently fail and you have to poll in a while loop to guarantee a write lands — that's a footgun if you don't read the docs carefully. The 48-byte key limit is arbitrary and annoying in practice; anything cache-worthy in a real app tends to have composite keys that exceed it. `flush()` is a lie — it marks items invalid without freeing memory, so if you're relying on flush to reclaim space under pressure you'll be surprised. Last meaningful commit is 2024 but activity has been sparse for years; PHP 8.x compatibility exists but this isn't a project with active momentum behind it.