desarrolla2/cache
Immutable PSR-16 simple cache library for PHP with multiple adapters (APCu, File, Memcached, Redis, MongoDB, etc.) plus a Chain adapter. Supports configurable options like default TTL via withOption/withOptions. Aims to be complete, correct, and fast.
Modularity & Extensibility:
Cache facade. This is ideal for functional programming patterns (e.g., pure, predictable cache operations) but may conflict with Laravel’s mutable expectations (e.g., method chaining like Cache::put()->forever()).database, array) are unsupported, requiring custom adapters or third-party wrappers.remember()). The package lacks built-in support for these, forcing workarounds (e.g., hybrid approaches or custom extensions).Laravel Compatibility:
Cache::tags(), Cache::remember()).Key Changes from v2.x:
Cache::put($key, $value)->setTTL(3600) → immutable CacheItem construction).remember()).Core Integration Points:
Cache facade with a custom provider binding the package’s CacheManager to Laravel’s container. Requires adapter wrappers for Laravel-native drivers (e.g., database).CacheItem objects:
// New (immutable):
Cache::set('key', (new CacheItem($value))->expiresAfter(3600));
database or array drivers. Requires third-party adapters (e.g., php-cache/adapter-*) or custom implementations.remember() are unsupported, requiring custom middleware or hybrid approaches.Dependencies:
php-cache/adapter-redis). Laravel’s native drivers will not work out-of-the-box.Testing Overhead:
remember() are unsupported, potentially breaking workflows reliant on these features.CacheItem objects with Laravel’s mutable APIs (e.g., Cache::tags()).Cache::put() vs. Cache::set())?database, array) being dropped? If so, how will this impact local development (e.g., Cache::store('array'))?remember() be handled if this package lacks native support?php-cache/adapter-*).database, array) require custom adapters.config/cache.php with package-specific settings (e.g., cache.default_adapter).stores, default settings).CacheItem objects:
// Before (Laravel native):
Cache::put('key', $value, 3600);
// After (immutable):
Cache::set('key', (new CacheItem($value))->expiresAfter(3600));
Cache::put( → Cache::set().Cache::put()->setTTL()) and replace with immutable equivalents.php-cache/adapter-redis).database cache) or abandon unsupported drivers.How can I help you explore Laravel packages today?