class Mongoid::QueryCache::CachedCursor

A Cursor that attempts to load documents from memory first before hitting the database if the same query has already been executed.

@since 4.0.0

Public Instance Methods

load_docs() click to toggle source

Override the loading of docs to attempt to fetch from the cache.

@example Load the documents.

cursor.load_docs

@return [ Array<Hash> ] The documents.

@since 4.0.0

Calls superclass method
# File lib/mongoid/query_cache.rb, line 228
def load_docs
  with_cache { super }
end

Private Instance Methods

cache_key() click to toggle source
# File lib/mongoid/query_cache.rb, line 234
def cache_key
  [ @database, @collection, @selector, @options[:limit], @options[:skip], @options[:fields] ]
end
system_collection?() click to toggle source
# File lib/mongoid/query_cache.rb, line 238
def system_collection?
  @collection =~ /^system./
end