-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
FEATURE: Add methods getSimpleCache PSR-16 and getCacheItemPool PSR-6 to the cacheManager #2689
FEATURE: Add methods getSimpleCache PSR-16 and getCacheItemPool PSR-6 to the cacheManager #2689
Conversation
b774830
to
26da33d
Compare
@mficzel Can you create a corresponding issue that this PR can link to? |
How is this different from the possibilities today of injecting a configured cache? |
@sorenmalling it allows to get instances of the psr Cache classes. Those are different from flowCache frontends but external libraries likely need those for caching. |
@kitsunet I remember us discussing how the psr caches should be instantiated back then. I think back then you planned something similar but for some reason we decided to only provide the psr factories back then as a first step. Probably it was my fault back talking you out of this because i feared users would access the same cache via different interfaces. Had some use cases in the meantime where i would have liked the option to inject those cache-interfaces. |
Just for reference, with the PSR factories of
Yeah, that's really a pandora box waiting to be opened. I see no good way around that though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally approve. It's nice to be able to configure PSR caches and inject them like Flow caches.
Can the documentation be extended with a explanation on why it's not a good thing to access the same vacate with multiple interfaces? |
@sorenmalling changed
to
As already was in the docs |
…Manager The methods create an PSR Frontend for the cache with the given identifier. The following settings in Objects.yaml allow to inject PSR Caches into Flow Classes: ``` Vendor\Site\Service: properties: simpleCacheProperty: object: factoryObjectName: Neos\Flow\Cache\CacheManager factoryMethodName: getSimpleCache arguments: 1: value: Cache_Identifier_1 cachePoolProperty: object: factoryObjectName: Neos\Flow\Cache\CacheManager factoryMethodName: getCacheItemPool arguments: 1: value: Cache_Identifier_2 ``` !!! While possible it is not advisible to access the same cache with multiple Interfaces !!!
… are used in there This changes nothing regarding installed packages as those were required by Neos.Cache anyways.
5fe1151
to
2350bfd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good by reading.
I guess people will shoot themselves in the foot by accessing the same cache from two sides, but… 🤷♂️
The methods create PSR Frontends for the cache with the given identifier. This allows to configure psr caches via
objects and caches yaml. This is an improvement as the included factories are not that easy to use.
The following settings in Objects.yaml allow to inject PSR Caches into Flow Classes:
!!! While possible it is not advisible to access the same cache with multiple Interfaces as the storage formats may differ. !!!
Resolves: #2690
Checklist