toflar/psr6-symfony-http-cache-store
PSR-6 compatible store for Symfony HttpCache using Symfony Cache + Lock. Adds tag-based invalidation, automatic pruning of expired entries, configurable adapters/locks, and BinaryFileResponse support. Avoids unbounded cache directory growth.
HttpClient improvements), validate compatibility with cached responses.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| PHP 8.1+ Requirement | High | Upgrade PHP version if <8.1. Plan fallback for legacy environments. |
| Symfony 8 Dependency | Medium | Test with Symfony 8 if adopting it; ensure backward compatibility for Symfony 6/7. |
| Storage Backend | Medium | Document required PSR-6 store (e.g., Redis, database) and test with large responses. |
| Auto-Pruning Overhead | Medium | Benchmark pruning impact in high-write scenarios (PHP 8.1+ may improve performance). |
| Key Normalization | Low | Validate against PHP 8.1+ edge cases (e.g., new HTTP headers, response serialization). |
HttpClient) that might interact with cached responses?toflar/psr6-symfony-http-cache-store in config/packages/cache.yaml:
framework:
http_cache:
store: toflar.psr6_symfony_http_cache_store
services:
toflar.psr6_symfony_http_cache_store:
class: Toflar\Psr6SymfonyHttpCacheStore\Store
arguments:
$cachePool: '@cache.app' # PSR-6 cache pool (e.g., Redis)
Psr\Http\Message interfaces:
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Message\ResponseInterface;
class HttpCacheWrapper {
public function __construct(private CacheItemPoolInterface $cache) {}
public function cacheResponse(string $key, ResponseInterface $response): void {
$item = $this->cache->getItem($key);
$item->set($response->getBody()->getContents());
$this->cache->save($item);
}
}
Vary: Accept-Encoding, User-Agent, etc., in PHP 8.1+.If-None-Match requests work correctly.toflar/psr6-symfony-http-cache-store.How can I help you explore Laravel packages today?