You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CacheFor annotation does not allow customisation of this cache key. This is useful in case you your controller shows different page based on the session. For example if you viewing different language version of the website the URL will be the same but the locale information is in the session. Having a way to customise this cache key helps in lot different cases of caching.
At the moment when you annotate an Controller method with CacheFor. Play framework generate the cache key as follow in ActionInvoker.java line 152:
CacheFor annotation does not allow customisation of this cache key. This is useful in case you your controller shows different page based on the session. For example if you viewing different language version of the website the URL will be the same but the locale information is in the session. Having a way to customise this cache key helps in lot different cases of caching.
My proposal is to extend the @CacheFor as follow:
Where CacheKeyGenerator is a simple interface that generate the cache key.
Then we can modify the InvokerAction.invoke to generate the cache key based on the CacheKeyGenerator.
You can use a custom CacheKeyGenerator as follow:
If you do not specify the
generator
the default key generator will be used as usual.PS: I am working on a pull request to this issue
The text was updated successfully, but these errors were encountered: