cache/illuminate-adapter
PSR-6 cache pool adapter for Laravel Illuminate cache stores. Wrap any Illuminate\Cache\Store (e.g., ArrayStore) to use via standard PSR-6 CacheItemPoolInterface. Part of the PHP-Cache organization with shared docs on tags and hierarchy.
Cache::tags()) for granular invalidation, critical for dynamic data (e.g., e-commerce, SaaS). PSR-6’s deleteByTag() integrates seamlessly.Illuminate\Cache\Store instances without modifying core logic. Ideal for incremental migration.Cache::store() with PSR-6 calls (e.g., $pool->getItem('key')) without altering Laravel’s configuration.RedisStore, DatabaseStore, etc.), including custom implementations.composer require with no transitive conflicts. MIT license allows internal modifications.getItem(), deleteMultiple()), but edge cases (e.g., getMultiple() with tags) may need manual testing.deleteByTag() if Laravel’s tagging system isn’t thread-safe.Cache::tags() method signatures)?deleteByTag() interact with Laravel’s tagging system under high concurrency?MemcachedStore or DatabaseStore (e.g., tagging performance)?predis/predis)?has() (PSR-6 1.1+) or other niche methods?ArrayStore for unit tests with PSR-6 interfaces.predis/predis) may outperform the adapter.Cache::events() or other non-PSR-6 features.Cache::remember()).ArrayStore for testing.deleteByTag() and getItem().$cache = new IlluminateCachePool(Cache::store('redis'));
$item = $cache->getItem('user:123:profile');
ArrayStore, FileStore, RedisStore, DatabaseStore.MemcachedStore, DynamoStore. Extend the adapter if needed.getItem(), save(), delete(), etc.) but lacks has() (PSR-6 1.1+). Polyfill if required.deleteByTag() works but may have edge cases under high concurrency.php-version constraint in composer.json if needed.Cache::remember() in repositories with PSR-6 calls.config/cache.php as usual.try {
$item = $cache->getItem('key');
} catch (Throwable $e) {
Log::error("Cache adapter failed: " . $e->getMessage());
// Fallback to direct Laravel cache
}
## Troubleshooting
### Known Issues
- `DatabaseStore` tagging may be slow under high load.
- `FileStore` does not support distributed invalidation.
### Performance
| Operation | Overhead vs. Native | Notes |
|-----------------|----------------------|--------------------------------|
| `getItem()` | <1% | Negligible |
| `deleteByTag()` | 5–10% | Test with Redis/Memcached |
deleteMultiple()) may add latency.predis/predis for Redis-specific workloads.DatabaseStore).| Scenario | Impact | Mitigation |
|---|---|---|
| Adapter throws undocumented error | PSR-6 consumer fails silently | Implement retry logic or fallbacks |
| Laravel cache driver fails | Cache pool becomes unusable | Use circuit breakers (e.g., cache/adapter-common) |
| Tagging inconsistencies | Stale data in consumers | Validate with integration tests |
| PHP version incompatibility | Runtime errors | Pin to a compatible PHP |
How can I help you explore Laravel packages today?