-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] ChainAdapter accepts CacheItemPoolInterface, so it should work with adapter of CacheItemPoolInterface other than \Symfony\Component\Cache\Adapter\AdapterInterface #60160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Sounds legit, please send a PR. |
PatchRanger
pushed a commit
to PatchRanger/symfony
that referenced
this issue
Apr 7, 2025
… should work with adapter of CacheItemPoolInterface other than \Symfony\Component\Cache\Adapter\AdapterInterface
PatchRanger
pushed a commit
to PatchRanger/symfony
that referenced
this issue
Apr 7, 2025
… should work with adapter of CacheItemPoolInterface other than \Symfony\Component\Cache\Adapter\AdapterInterface
nicolas-grekas
added a commit
that referenced
this issue
Apr 7, 2025
… Danilson) This PR was merged into the 6.4 branch. Discussion ---------- [Cache] Fix proxying third party PSR-6 cache items ...work with adapter of CacheItemPoolInterface other than \Symfony\Component\Cache\Adapter\AdapterInterface | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #60160 | License | MIT Commits ------- 74debe4 Fix #60160: ChainAdapter accepts CacheItemPoolInterface, so it should work with adapter of CacheItemPoolInterface other than \Symfony\Component\Cache\Adapter\AdapterInterface
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
7.*
Description
ChainAdapter
accepts list ofCacheItemPoolInterface
.It makes me assuming that I can use it together with either
AdapterInterface
or any external class implementingCacheItemPoolInterface
.If I got it correct, I can do such thing in my DI as
CacheItemPoolInterface
:But I can't. It leads to the TypeError (see below in Additonal context).
How to reproduce
I've created a minimal script to reproduce. it's attached.
reproducer.php.txt
Here's the text of the script, if that's more convenient.
In place of the
Psr6ToYii2Cache
can be any external (i.e., not implementing the\Symfony\Component\Cache\Adapter\AdapterInterface
) class that implements theCacheItemPoolInterface
.Possible Solution
I've fixed it locally by such fix:
vendor/symfony/cache/CacheItem.php
In my view it's adequate: as long as
ChainAdapter
acceptsCacheItemPoolInterface
, it's normal thatinnerItem
should be ofCacheItemInterface
.Additional Context
reproducer.php
without fix leads to such error message:The text was updated successfully, but these errors were encountered: