Closed zakajd closed 5 months ago
After thinking on this problem a little, I found a solution by running a find_one
query with "ignore_cache" flag after each update. This does the Write-through Cache Invalidation, but slightly slows down updates.
Hi @zakajd , Yes, there is no "smart cache" in Beanie for now. I plan to make interface for cahe soon, so everyone will be able to make custom caching logic. Or even packages with custom cache types. I think, it should help with this.
This issue is stale because it has been open 30 days with no activity.
This issue was closed because it has been stalled for 14 days with no activity.
Describe the bug For a document with both use_cache and use_revision turned on two consecutive updates result in RevisionIdWasChanged because for the update Beanie always uses a cached document.
To Reproduce
This is due to the fact, that "update" function internally does a call to "find_one" method with and fetches a stale version of the document.
Expected behavior This edge case should be supported, or at least an "ignore_cache" kwargs should be configurable for the update operation.