Class: Mongoid::QueryCache::CachedCursor
- Inherits:
-
Mongo::Cursor
- Object
- Mongo::Cursor
- Mongoid::QueryCache::CachedCursor
- Defined in:
- lib/mongoid/query_cache.rb
Overview
A Cursor that attempts to load documents from memory first before hitting the database if the same query has already been executed.
Instance Method Summary collapse
-
#each ⇒ Object
We iterate over the cached documents if they exist already in the cursor otherwise proceed as normal.
-
#inspect ⇒ String
Get a human-readable string representation of
Cursor
.
Instance Method Details
#each ⇒ Object
We iterate over the cached documents if they exist already in the cursor otherwise proceed as normal.
139 140 141 142 143 144 145 |
# File 'lib/mongoid/query_cache.rb', line 139 def each if @cached_documents @cached_documents.each{ |doc| yield doc } else super end end |
#inspect ⇒ String
Get a human-readable string representation of Cursor
.
155 156 157 |
# File 'lib/mongoid/query_cache.rb', line 155 def inspect "#<Mongoid::QueryCache::CachedCursor:0x#{object_id} @view=#{@view.inspect}>" end |