hydrakit / cache
A small key/value store behind one contract, with the atomic counters rate limiting needs.
Requires
- php: >=8.2
- hydrakit/core: ^0.24
- psr/clock: ^1.0
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
- ext-redis: Required by RedisStore; without it only ArrayStore is available.
Provides
None
Conflicts
None
Replaces
None
- dev-main / 0.24.x-dev
- v0.24.0
- v0.23.0
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.0
- v0.19.0
- v0.18.0
- v0.17.0
- v0.16.0
- v0.15.0
- v0.14.0
- v0.13.0
- v0.12.0
- v0.11.0
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.17
- v0.9.16
- v0.9.15
- v0.9.14
- v0.9.13
- v0.9.12
- v0.9.11
- v0.9.10
- v0.9.9
- v0.9.8
- v0.9.7
- v0.9.6
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.1
- v0.8.0
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.3
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.8
- v0.5.7
- v0.5.6
- v0.5.5
- v0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.1
- v0.4.0
- v0.3.4
- v0.3.3
This package is auto-updated.
Last update: 2026-10-02 15:43:53 UTC
README
Part of the Hydra PHP framework. Documentation: hydra.williamhleucka.com/docs.
Read-only mirror.
hydrakit/cacheis developed in hydra-foundation/hydra underpackages/cache, and republished here on every push. A commit pushed to this repository is overwritten by the next one; issues are disabled for that reason, and a pull request opened here cannot be merged. Both belong upstream.
A key/value store with expiry behind one contract, in two implementations:
Redis, shared by every process that connects to it, and an in-memory array for
tests and single-process tooling. The counter methods are why the contract is
narrow: increment() adds to a key and opens its expiry window on the first
hit, as one atomic step, and never re-arms that window afterwards. Anything
budgeting per client therefore counts against a window measured from the first
request rather than one a steady stream can hold open indefinitely. ArrayStore
is deliberately not a fallback for an unreachable Redis: it is per-process,
so behind a worker pool it would give each worker its own counters and multiply
every limit by the pool size.
A store that cannot answer must say so. An unreachable Redis raises, and so does
one that answers with an error: phpredis reports OOM, READONLY, NOAUTH and
WRONGTYPE by returning false, and (int) false is 0, which any limiter
reads as "no requests yet". Deploy Redis with maxmemory-policy noeviction for
the same reason, since an evictable counter is a budget that memory pressure,
or anyone able to create it, can clear. REDIS_READ_TIMEOUT bounds the wait for
a reply; the connect timeout covers only the handshake.