fig/cache-util
Utilities for building PSR-6 cache libraries: traits and base classes that handle common boilerplate for cache pools and items. Includes a simple in-memory PSR-6 implementation for demos and debugging (not production-ready).
Illuminate\Cache already adheres to PSR-6, making this package ideal for extending or standardizing internal cache logic (e.g., shared CacheItem traits across microservices or custom drivers).CacheItemPoolTrait for pool logic) without adopting the entire package. This avoids bloat in simple use cases.Cache facade or PSR-6 implementations. It can be gradually integrated into custom cache drivers or shared libraries.FileCache). Misuse (e.g., deploying the in-memory demo to production) could cause data loss or performance issues.Cache facade already implements PSR-6, this package won’t replace it but could standardize internal cache item handling. Teams must avoid mixing facade methods (e.g., Cache::remember()) with raw PSR-6 calls where utilities are applied.CacheItem traits across services)?Cache facade sufficient, or do we need lower-level PSR-6 utilities for internal consistency?Illuminate\Cache (PSR-6 compliant). Can be used to:
CacheItem logic for S3, database, or Redis backends).getItem(), save() implementations).CacheItem logic manually, this package could centralize it.CacheItem logic for CacheItemPoolTrait).CacheItem traits across non-critical services (e.g., a reporting microservice).$this->app->bind(CacheItemInterface::class, function ($app) {
return new SharedCacheItem($app->make(CacheItemPoolInterface::class));
});
Cache::remember()) with raw PSR-6 calls where package utilities are applied. Example:
CacheItemPoolTrait for custom drivers.Cache::put() (already PSR-6-compliant).CacheItem traits with Redis").How can I help you explore Laravel packages today?