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
Yes, it does not use caching at the moment because the following situation is a little bit tricky if caching is enabled, at least the way it works at the moment:
$qb = $store->createQueryBuilder();
$qb->where('name', "=", "abc")->getQuery()->first() // returns one document and caches it$qb = $store->createQueryBuilder();
$qb->where('name', "=", "abc")->getQuery()->fetch() // returns one document, because of the cache
The token is set in the Cache object once on creation.
I thought about multiple ways to solve this issue and I think the best solution could be to either:
Create two new methods called setTokenAddition and removeTokenAddition
Add a new optional parameter called $cacheTokenAddition to most methods of the Cache class
PS: The solutions are meant for internal use but of course they also can be used outside.
1. Solution
function setTokenAddition(array$tokenAddition): Cache
function removeTokenAddition(): Cache
Pro
Con
Easy to use
Cache Class is stateful
Easy to implement
If not removed it can have not wanted side effects
More versatile
Other methods have nothing to do with the cache addition
@Timu57 The idea behind the first solution is to be able to add a custom value to the token? I think in previous implementation we used to use the flag for each method, in this case it was probably returnFirst something like that. So, now instead we will introduce a new method that we can manually add a value to the token?
@Timu57 The idea behind the first solution is to be able to add a custom value to the token? I think in previous implementation we used to use the flag for each method, in this case it was probably returnFirst something like that. So, now instead we will introduce a new method that we can manually add a value to the token?
The method will be added to the Cache class, means the user normally never comes in contact with it.
Activity
rakibtg commentedon Jan 13, 2021
Is they are not already?
Timu57 commentedon Jan 13, 2021
Yes, it does not use caching at the moment because the following situation is a little bit tricky if caching is enabled, at least the way it works at the moment:
The token is set in the Cache object once on creation.
I thought about multiple ways to solve this issue and I think the best solution could be to either:
setTokenAdditionandremoveTokenAddition$cacheTokenAdditionto most methods of the Cache classPS: The solutions are meant for internal use but of course they also can be used outside.
1. Solution
Example with one addition:
Example with two additions:
2. Solution
Example implementation with get:
Example implementation with set:
New Cache File Naming
Current max file name length is 82:
What I would prefer
I think both solutions are good in their own way but I tend towards the first solution.
rakibtg commentedon Jan 14, 2021
@Timu57 The idea behind the first solution is to be able to add a custom value to the token? I think in previous implementation we used to use the flag for each method, in this case it was probably
returnFirstsomething like that. So, now instead we will introduce a new method that we can manually add a value to the token?Timu57 commentedon Jan 14, 2021
The method will be added to the Cache class, means the user normally never comes in contact with it.