-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Add PdoTagAwareAdapter
#58296
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
base: 7.4
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
PdoAdapter
tag aware
Thanks for looking into this topic.
|
The problem as far as I could see (feel free to double-check and correct) is that the only alternative for this use case would be the general
Hmm, I guess we could. It would make the PR a bit more bloated because I guess we'd also follow the Redis schema and extract common logic into a |
PdoAdapter
tag awarePdoTagAwareAdapter
@nicolas-grekas like this? Not sure how to best fix the remaining Psalm issue. It's the same in all other cache adapters as far as I could see but the baseline protects those. But yes, in theory |
{ | ||
$conn = $this->getConnection(); | ||
|
||
$stmt = $conn->prepare("DELETE FROM $this->tagsTable WHERE $this->idCol NOT IN (SELECT $this->idCol FROM $this->table)"); |
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.
should this adapter use a foreign key with ON DELETE CASCADE
instead ?
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 decided against this on purpose. It's simpler like 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.
why is it simpler to require handling orphaned tags explicitly ?
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.
Sure, if you think that is better, please provide the necessary changes. I have no clue how oci
and sqlsrv
work and no motivation to learn about them 😄 We can also just do it for the others and throw an exception for those ones and ask the community to finish the implementation. Whoever needs it. But the current query likely works on all platforms.
was looking for this exact feature. thanks @Toflar. |
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
cc64fd2
to
49d24d1
Compare
Well I have incorporated the requested changes and then never heard back regarding the Psalm issue. I have rebased onto 7.3 now which is about all I can do I guess 😊 Failed 8.4 tests are unrelated. |
I noticed that unfortunately, the
PdoAdapter
in the cache component does not natively support cache tagging. This forces you to use it in combination with the generalTagAwareAdapter
which has a few downsides when it comes to performance. So I figured, why not try to add native support.