Sha256: 2f1bc1395a682df988bcbab072a54b49c5555c962b001506ac34c1b6d4f865f7
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Caching #:nodoc: def self.included(base) base.class_eval do extend ClassMethods class_inheritable_accessor :cached self.cached = false delegate :cached?, :to => "self.class" end end module ClassMethods #:nodoc # 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: # # class Person # include Mongoid::Document # cache # end def cache self.cached = true end # Determines if the class is cached or not. # # Returns: # # True if cached, false if not. def cached? self.cached == true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-1.2.8 | lib/mongoid/caching.rb |