The cache/tag-interop package (abandoned) has been replaced with the actively maintained symfony/cache-contracts.
What changed:
CacheInvalidateconstructor now accepts anyPsr\Cache\CacheItemPoolInterfaceinstead of requiringCache\TagInterop\TaggableCacheItemPoolInterface.
What to do:
Inject any Psr\Cache\CacheItemPoolInterface. For tag-based cache invalidation to work, the implementation must also implement Symfony\Contracts\Cache\TagAwareCacheInterface (e.g., Symfony's TagAwareAdapter).
If the cache pool does not support tagging, CacheInvalidate silently skips the invalidation step.
Example:
// Before
use Cache\TagInterop\TaggableCacheItemPoolInterface;
$cache = new TaggableCacheItemPoolInterface(); // Required interface
$endpoint = new CacheInvalidate('name', '/url', $cache);
// After
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
$cache = new SomePoolImplementation(); // Just needs CacheItemPoolInterface
// If it also implements TagAwareCacheInterface, tagging will work automatically.
$endpoint = new CacheInvalidate('name', '/url', $cache);For tag invalidation to function, use an implementation that implements both interfaces, such as Symfony's TagAwareAdapter:
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
$cache = new TagAwareAdapter(new FilesystemAdapter());
$endpoint = new CacheInvalidate('name', '/url', $cache);