-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Query
-
Fully Compatible
Mongoid has a feature where calling reload on a model would not read from query cache:
# Bypass the query cache when reloading a document.
module Document
def reload
QueryCache.uncached { super }
end
end
When QC is enabled, what I assume would then happen is if the model in question was in the cache, this call would read from the database but the cache wouldn't be cleared and subsequent queries of this model might use the (stale) data from cache.
I can see this solved in one of two ways:
- Add a mechanism where the query would always be fulfilled from the database but the result would be written to query cache
- When QueryCache was enabled in outer scope and is disabled in inner scope, any query on a collection + any write query would invalidate the respective cache(s) but not write to them.
The first approach seems to provide more value to applications.