Module: Mongoid::AttributeCache

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid_misc/attribute_cache.rb

Instance Method Summary collapse

Instance Method Details

#cacheObject



4
5
6
# File 'lib/mongoid_misc/attribute_cache.rb', line 4

def cache
  @cache ||= {}
end

#clear_cacheObject



8
9
10
# File 'lib/mongoid_misc/attribute_cache.rb', line 8

def clear_cache
  @cache = {}
end

#reloadObject



12
13
14
15
# File 'lib/mongoid_misc/attribute_cache.rb', line 12

def reload
  @cache.clear if @cache
  super
end