Module: ActiveSupport::Cache::Strategy::LocalCache
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | activesupport/lib/active_support/cache/strategy/local_cache.rb, activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb |
Overview
Local Cache Strategy
Caches that implement LocalCache
will be backed by an in-memory cache for the duration of a block. Repeated calls to the cache for the same key will hit the in-memory cache for faster access.
Instance Method Summary
-
#middleware
Middleware
class can be inserted as a::Rack
handler to be local cache for the duration of request. -
#with_local_cache(&block)
Use a local cache for the duration of block.
Instance Method Details
#middleware
LocalCache::Middleware
class can be inserted as a ::Rack
handler to be local cache for the duration of request.
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 73
def middleware @middleware ||= Middleware.new( "ActiveSupport::Cache::Strategy::LocalCache", local_cache_key) end
#with_local_cache(&block)
Use a local cache for the duration of block.
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 67
def with_local_cache(&block) use_temporary_local_cache(LocalStore.new, &block) end