Class: Mongoid::QueryCache::CachedCursor

Inherits:
Moped::Cursor
  • Object
show all
Includes:
Cacheable
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.

Since:

  • 4.0.0

Instance Method Summary collapse

Instance Method Details

#load_docsArray<Hash>

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

Examples:

Load the documents.

cursor.load_docs

Returns:

  • (Array<Hash>)

    The documents.

Since:

  • 4.0.0



229
230
231
# File 'lib/mongoid/query_cache.rb', line 229

def load_docs
  with_cache { super }
end