Cache facade, CacheManager, and third-party PSR-16-compliant backends (e.g., Redis, Memcached). This allows for backward compatibility with existing Laravel caching logic while adding bounded TTL constraints.cache:tags system, enabling tag-based invalidation while respecting TTL bounds.cache:flush and cache:forget queues for distributed systems.BoundedCacheEvicted) for observability.CacheManager to include a bounded driver.Cache::extend() to wrap existing stores.AppServiceProvider.database driver).minTTL/maxTTL for specific keys.v2.2.1 (supports PHP 8.0–8.4).set()/evict() operations could lead to inconsistent states in high-traffic apps. Risk Mitigation:
SET with NX flag) if underlying store supports it.EXPIRE vs. package eviction).cache:tags invalidation.CacheStoreEvent) may need updates for bounded evictions.0.5–5ms)?Cache::store() to support bounded drivers.BoundedCache as a custom driver in config/cache.php.GrahamCampbell\BoundedCache\BoundedCache to cache or extend existing bindings.Cache::remember() with bounded stores for HTTP responses.Predis\Client or Memcached with BoundedCache.Illuminate\Cache\DatabaseStore to enforce bounds.file or array drivers.BoundedCacheEvicted) via Laravel’s Events system.file cache driver with BoundedCache:
// config/cache.php
'stores' => [
'bounded' => [
'driver' => 'bounded',
'store' => 'file', // Underlying PSR-16 store
'min_ttl' => 60, // Optional: Default min TTL
'max_ttl' => 3600, // Optional: Default max TTL
],
];
// app/Providers/AppServiceProvider.php
public function register()
{
Cache::extend('bounded', function ($app) {
$store = Cache::store('redis'); // Underlying store
return new BoundedCache($store, maxTTL: 300);
});
}
config/cache.php:
'default' => env('CACHE_DRIVER', 'bounded'),
// app/Providers/AppServiceProvider.php
public function boot()
{
$app = $this->app;
$app->resolving('cache', function ($cache, $app) {
return new BoundedCache($cache, maxTTL: 3600);
});
}
// app/Providers/AppServiceProvider.php
public function boot()
{
BoundedCache::evicting(function ($key) {
Log::debug("Bounded eviction triggered for key: {$key}");
});
}
predis/predis (Redis).php-memcached (Memcached).illuminate/cache (Database/File).Cache facade (e.g., spatie/laravel-cache).cache:flush and cache:forget queues.How can I help you explore Laravel packages today?