ENH Migrate away from deprecated Symfony cache classes #10187
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue silverstripe/silverstripe-fulltextsearch#302
Symfony
*Cache
classes (e.g. PhpFilesCache) were deprecated and their replacements are Symfony*Adapter
classes (e.g. PhpFilesAdapter)These
*Adapter
classes have support for 2 different cache stylesPsr\SimpleCache\CacheInterface
- this is the API that Silverstripe classes expect e.g.DefaultCacheFactory
The solution I've proposed here is to create an adapter class
SymfonyAdapterToPsr6Cache
that implements the PSR6CacheInterface
and wraps the SymfonyAbstractAdatper
classIf we were to update Silverstripe classes to use "Cache contracts", due to semver we'd need to write entirely new classes and deprecate the old ones as there is plenty of API that expects a
CacheInterface
Note: there are 2 different 'CacheInterface` with different APIs
Psr\SimpleCache\CacheInterface
- The existing Psr6 interfaceSymfony\Contracts\Cache\CacheInterface
- The new Symfony Cache Contracts interfaceThe error message on the issues says
use "Symfony\Component\Cache\Adapter\PhpFilesAdapter" and type-hint for "Symfony\Contracts\Cache\CacheInterface" instead.
-- this is recommending the Cache Contracts interface with is different to what we're currently using.TODO: