webpatser/laravel-resp3-cache is a synchronous Redis client and Laravel cache driver backed by the php-resp3 C parser. Point your redis.client config at resp3 and your existing Cache::* calls parse responses through the C extension instead of pure-PHP code.
Warning: This is a 0.x release. The API may change, and breaking changes can land in any 0.x minor. Version 0.9 needs PHP 8.6 and ext-resp3
^0.3. On PHP 8.4 or 8.5, stay on 0.8.x with ext-resp3 0.2.x.
What it provides
- A
resp3Redis client that plugs into Laravel'sRedisManager. The standardrediscache driver picks it up. - A
resp3cache driver (Resp3Store, aRedisStoresubclass) that uses newer server commands when the server has them: single-commandadd(), atomicputMany(), compare-and-set, and lock release without Lua. - Cache tags on the
resp3store, on every topology. - Opt-in client-side caching through
CLIENT TRACKING, with an array or APCu local store. - Cluster mode with slot routing,
MOVEDandASKhandling and optional replica reads. - Sentinel mode with reactive failover and optional replica reads.
- Pub/Sub through
Redis::subscribe()andRedis::psubscribe(), plus sharded pub/sub (ssubscribe()) on a cluster. - Server feature detection for Redis and Valkey.
Where it helps
Cache-heavy read patterns (one round trip that returns many small values) spend most of their PHP time inside the parser. The package replaces that parse step with the C implementation. The gain is largest on Cache::many(), Cache::tags()->many() and large HGETALL reads. Single-key Cache::get workloads are dominated by round-trip latency, so the parser swap matters less there. The one benchmark in the repository is on the Benchmarks page.
Requirements
| Layer | Versions |
|---|---|
| PHP | 8.6 |
| Laravel | 11, 12, 13 |
| ext-resp3 | ^0.3 (see php-resp3) |
| Redis or Valkey | 6.0+ (RESP3 capable); optional commands need the versions listed on the Configuration page |
The package supports only the latest stable PHP release. When a new PHP version is released, the next release of this package requires it and support for the previous PHP version ends.
Limitations
- Sentinel replica reads use random selection only.
- Sharded pub/sub has no pattern equivalent (
SPSUBSCRIBEis not in the Redis spec). - No connection pooling beyond
STREAM_CLIENT_PERSISTENT. - Client-side caching works on single node and sentinel connections only; cluster connections ignore it.
featuresoverrides are not supported on cluster connections.- On a cluster,
cache:prune-stale-tagsfinds tags withSCAN, which reaches one node only, so tags stored on other nodes are not pruned.
License
MIT.