Module: ActiveModel::Caching
- Extended by:
- ActiveSupport::Concern
- Includes:
- GlobalID::Identification
- Defined in:
- lib/active_model/caching.rb,
lib/active_model/caching/version.rb
Overview
Provides with a set of methods allowing to cache data structures at the object level
Constant Summary collapse
- VERSION =
"0.1.2"
Class Attribute Summary collapse
-
.cache_store ⇒ ActiveSupport::Cache::Store
Returns the cache store to use for caching attributes.
-
.global_id_app ⇒ String?
Returns the application name used for GlobalID generation.
Class Method Summary collapse
-
.setup {|ActiveModel::Caching| ... } ⇒ void
Configures the gem with a block.
Class Attribute Details
.cache_store ⇒ ActiveSupport::Cache::Store
Returns the cache store to use for caching attributes. Defaults to Rails.cache if Rails is defined, otherwise uses MemoryStore.
36 37 38 |
# File 'lib/active_model/caching.rb', line 36 def cache_store @cache_store ||= default_cache_store end |
.global_id_app ⇒ String?
Returns the application name used for GlobalID generation. Defaults to GlobalID.app if present, then Rails.application.name if Rails is defined.
44 45 46 |
# File 'lib/active_model/caching.rb', line 44 def global_id_app @global_id_app ||= default_global_id_app end |
Class Method Details
.setup {|ActiveModel::Caching| ... } ⇒ void
This method returns an undefined value.
Configures the gem with a block. Example:
ActiveModel::Caching.setup do |config|
config.cache_store = Rails.cache
config.global_id_app = 'MyApp'
end
28 29 30 |
# File 'lib/active_model/caching.rb', line 28 def setup yield self end |