Module: Mongoid::QueryCache
- Defined in:
- lib/mongoid/query_cache.rb
Overview
A cache of database queries on a per-request basis.
Constant Summary collapse
- Middleware =
Mongo::QueryCache::Middleware
Class Method Summary collapse
-
.cache(&block) ⇒ Object
Execute the block while using the query cache.
-
.clear_cache ⇒ nil
Clear the query cache.
-
.enabled=(value) ⇒ Object
Set whether the cache is enabled.
-
.enabled? ⇒ true | false
Is the query cache enabled on the current thread?.
-
.uncached(&block) ⇒ Object
Execute the block with the query cache disabled.
Class Method Details
.cache(&block) ⇒ Object
Execute the block while using the query cache.
49 50 51 52 |
# File 'lib/mongoid/query_cache.rb', line 49 def cache(&block) Mongoid::Warnings.warn_mongoid_query_cache Mongo::QueryCache.cache(&block) end |
.clear_cache ⇒ nil
Clear the query cache.
16 17 18 19 |
# File 'lib/mongoid/query_cache.rb', line 16 def clear_cache Mongoid::Warnings.warn_mongoid_query_cache_clear Mongo::QueryCache.clear end |
.enabled=(value) ⇒ Object
Set whether the cache is enabled.
27 28 29 30 |
# File 'lib/mongoid/query_cache.rb', line 27 def enabled=(value) Mongoid::Warnings.warn_mongoid_query_cache Mongo::QueryCache.enabled = value end |