sailantis / azera-cache
Cache companion for the Azera framework: production-grade PSR-16 backends (Redis, File, APCu, Memcached, Memory) and decorators (Chain, Taggable, Namespace, Memoizing).
Requires
- php: >=8.2
- psr/simple-cache: ^3.0
- sailantis/azera-framework: ^0.4.1 || dev-main
Requires (Dev)
- phpunit/phpunit: ^10.5
Suggests
- ext-apcu: For ApcuCache backend.
- ext-memcache: For MemcacheCache backend, the legacy ext-memcache adapter (requires a running memcached server).
- ext-memcached: For MemcachedCache backend (requires a running memcached server).
- ext-redis: For RedisCache backend (requires a running Redis server).
Provides
None
Conflicts
None
Replaces
None
README
Cache companion for the Azera framework.
The framework ships PSR-16 dev/null implementations (ArrayCache, NullCache, InvalidArgumentException). This package provides the production-grade backends the docs defer (docs/14-CACHE.md):
Azera\Cache\Backend\RedisCache—ext-redisadapter with pipelined batch operations.Azera\Cache\Backend\FileCache— sharded, atomic-write file cache (no extension needed).Azera\Cache\Backend\ApcuCache—ext-apcusingle-host shared-memory adapter (no external program needed).Azera\Cache\Backend\MemcachedCache—ext-memcachedadapter (requires a running memcached server).Azera\Cache\Backend\MemcacheCache—ext-memcache(legacyMemcacheclass) adapter (requires a running memcached server).Azera\Cache\Backend\MemoryCache— bounded, array-backed cache with LRU eviction for long-running daemons.Azera\Cache\Decorator\ChainCache— layered read-through with write-through + stampede protection.Azera\Cache\Decorator\TaggableCache— tag-based invalidation on top of any PSR-16 backend.Azera\Cache\Decorator\NamespaceCache— key-prefix decorator for multi-tenant isolation.Azera\Cache\Decorator\MemoizingCache—remember($key, $ttl, $loader)with optional locking.
Note on external programs:
MemcachedCacheandMemcacheCacheboth require a running memcached server in addition to the PHP extension.RedisCacherequires a Redis server.ApcuCacheandMemoryCacheandFileCacheneed nothing extra.
All backends implement \Psr\SimpleCache\CacheInterface directly (per patterns.md: depend on the PSR, no framework-specific cache interface) and reuse the framework's Azera\Cache\InvalidArgumentException for key validation.
Installation
composer require sailantis/azera-cache
License
MIT.