Methods

Class/Module Index [+]

Quicksearch

Mongoid::Extras::ClassMethods

Public Instance Methods

cache() click to toggle source

Sets caching on for this class. This class level configuration will default all queries to cache the results of the first iteration over the cursor into an internal array. This should only be used for queries that return a small number of results or have small documents, as after the first iteration the entire results will be stored in memory.

@example Cache all reads for the class.

class Person
  include Mongoid::Document
  cache
end
# File lib/mongoid/extras.rb, line 25
def cache
  self.cached = true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.