-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache]: Get invalid cache items #27294
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
Comments
I've been wondering about something like that also. Right now, I feel like doing it with "graced" items might create a high amount of complexity, requiring new methods to fetch items from graced pools, being able to deal with a mix of hard and soft deleted items (should we create a set of interfaces/methods to allow controlling hard/soft delete, etc.)? I've recently proposed two PRs that are related:
I'm wondering if these proposed approches couldn't be enough in practice to make it unecessary to implement anything like graced items. That'd be great because that'd mean less complexity. |
I think I found a way:
Would this be possible? Especially I wonder if 2. is possible (get cache items by tag). |
"2." is not possible, and I think it goes off topic actually. Being able to do that requires a relational system, which does not exist and poses scalability issues. Solvable for sure, but not in a generic way IMHO. |
You mean by implementing an own class which implements TagAwareAdapterInterface? |
correct! |
I underestimated your "if you happen to be able to know which items relate to a tag" Is it possible to let AdapterInterface::getItems() return all items, regardless whether they are valid or not? Invalidated items could get isHit = false. We could introduce a second parameter $invalid = false to AdapterInterface::getItems() so there would not be a backwards incomptible change. |
I think it's not: design wise having a well though but restricted domain is desired. E.g. fetching all items from the backend doesn't scale with millions of items... |
I meant not all items in general but all items which have the given key or tags, e.g. AdapterInterface::getItems(['foo']) could return CacheItems with isHit=true (valid items) and with isHit=false (invalid items). |
that still exposes to the scalability issue and requires storing the relation in the backend. |
Closing as "won't fix", as explained. Thanks for proposing. |
Description
It would be nice of one could get invalid cache items of a tag-based cache adapter to be able to warmup a cache after some items got invalid.
Example
Database query and its result get saved as serialized object together with tag 'test'. Due to a change all cache items with tag 'test' get invalid (via TagAwareAdapter::invalidateTags(['test'])). Later on it would be nice to fetch all invalid entries to re-warmup the cache by executing the queries and fill the cache with the current values.
The text was updated successfully, but these errors were encountered: