-
Notifications
You must be signed in to change notification settings - Fork 0
[Cache] Improve packing tags into items #1
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
[Cache] Improve packing tags into items #1
Conversation
ca8e161
to
b2ef579
Compare
$isTagPoolCleared = $this->tags->clear(static::TAG_PREFIX.$prefix); | ||
} else { | ||
$isTagPoolCleared = $this->tags->clear(); | ||
} |
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.
Clearing tags doesn't make sense, to me. Let me know if you think I'm wrong.
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.
Second read: not clearing tags was on purpose. Tags could be shared among several item pools and clearing them for one pool would break this use case. If one wants to clear tags, they should call the method on the tags pool directly.
|
||
return $this->tags instanceof PruneableInterface && $this->tags->prune() && $isPruned; | ||
return $this->pool instanceof PruneableInterface && $this->pool->prune(); |
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 return value only needs confirmation that the data has been pruned to me. Pruning tags is a bonus that doesn't impact the validity of pruning itself. Do you agree?
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.
Actually, tags are persisted "forever", so they don't need to/cannot be pruned.
014765e
to
f34d82a
Compare
PR updated to keep compat with already populated pools. |
c59be36
to
ec21011
Compare
Now with a special storage class (named |
ec21011
to
e252a3c
Compare
I added back Let me know if I missed any features/behaviors that you wanted to achieve @sbelyshkin I'm going to wait for your feedback/review now. |
e252a3c
to
210b4cb
Compare
Last change: added |
@@ -32,6 +32,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter | |||
|
|||
private bool $storeSerialized; | |||
private array $values = []; | |||
private array $tags = []; |
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 regular adapter know about tags?
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.
Only about metadata, and tags are part of them. That's OK to me.
I think the attached patch would be a nice improvement on top of symfony#42997
Please don't merge, that's for discussion (Tests don't pass)Basically, this delegate the serialization of tags to the wrapper adapters instead of letting TagAwareAdapter manage that part.