-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Make query cache rely on entity timestamp region #6001
Conversation
5513384
to
fac2097
Compare
I had an idea to improve this PR a bit by moving the timestamp region check to the query cache validator but this also means moving the I think it's a better solution, what's your opinion? |
@lcobucci indeed that's a MUCH BETTER solution. If I understood your idea correctly, you'd eliminate the BC break by adding a new interface method. If you're willing to work on that, I'd appreciate. |
@guilhermeblanco I really need this to be part of 2.X so I'm glad to help 😉
My idea basically is:
The biggest question here is: what'd be the best place to retrieve the Moving those things to que validator also simplifies the |
/** | ||
* @return \Doctrine\ORM\Cache\TimestampCacheKey | ||
*/ | ||
public function getTimestampKey(); |
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.
bc break, sadly
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.
Also, I don't know how to regenerate a timestamp key, if not retrieved from here.
Ow ofc. Do you think that the solution I explained is applicable? |
@lcobucci moving more info to the |
fac2097
to
2b98a59
Compare
@guilhermeblanco @Ocramius introduced a tiny duplication in order to remove the BC break. I think it should be ok to be merged on v2.X now. Anything else? |
2b98a59
to
7a80a90
Compare
|
||
private function regionUpdated(QueryCacheKey $key, QueryCacheEntry $entry) | ||
{ | ||
if ($key->timestampKey === null) { |
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.
The docblock states that it is never null
: can you check that?
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.
The docblock is a liar! Will fix that, thanks
7a80a90
to
5239722
Compare
@guilhermeblanco @Ocramius comments processed let me know if there's anything else preventing this to be merged and let's |
@@ -38,18 +38,18 @@ class QueryCacheEntry implements CacheEntry | |||
/** | |||
* READ-ONLY: Public only for performance reasons, it should be considered immutable. | |||
* | |||
* @var integer Time creation of this cache entry | |||
* @var float Time creation of this cache entry |
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.
Since there was a change here, did you check all usages of this property?
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.
I did but I definitely forgot to change ($entry->time + $key->lifetime) > time()
to ((int) $entry->time + $key->lifetime) > time()
on the validator
5239722
to
9130d8c
Compare
…-region-2.5' into 2.5 Close #6001
…pe - specific version used
…ed in `master`, not in `2.5`)
As far as I saw that's the default Hibernate behavior (https://vladmihalcea.com/2015/06/08/how-does-hibernate-query-cache-work/) to keep the query cache consistent.
I'm just not sure if that is the way to go, basically because of the change on the
CachedEntityPersister
interface (I didn't want to duplicate the logic that generates the timestamp key).