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.
Middleware class can be inserted as a Rack handler to be local cache for the duration of request.
# File lib/active_support/cache/strategy/local_cache.rb, line 80 80: def middleware 81: @middleware ||= Middleware.new( 82: "ActiveSupport::Cache::Strategy::LocalCache", 83: thread_local_key) 84: end
Use a local cache for the duration of block.
# File lib/active_support/cache/strategy/local_cache.rb, line 43 43: def with_local_cache 44: save_val = Thread.current[thread_local_key] 45: begin 46: Thread.current[thread_local_key] = LocalStore.new 47: yield 48: ensure 49: Thread.current[thread_local_key] = save_val 50: end 51: end
# File lib/active_support/cache/strategy/local_cache.rb, line 157 157: def bypass_local_cache 158: save_cache = Thread.current[thread_local_key] 159: begin 160: Thread.current[thread_local_key] = nil 161: yield 162: ensure 163: Thread.current[thread_local_key] = save_cache 164: end 165: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.