class ActiveSupport::Cache::Strategy::LocalCache::LocalStore

Parent:
ActiveSupport::Cache::Store

Simple memory backed cache. This cache is not thread safe and is intended only for serving as a temporary memory cache for a single thread.

Public Class Methods

new() Show source
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 39
def initialize
  super
  @data = {}
end
Calls superclass method ActiveSupport::Cache::Store.new

Public Instance Methods

clear(options = nil) Show source
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 49
def clear(options = nil)
  @data.clear
end
delete_entry(key, options) Show source
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 73
def delete_entry(key, options)
  [email protected](key)
end
read_entry(key, options) Show source
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 53
def read_entry(key, options)
  @data[key]
end
read_multi_entries(keys, options) Show source
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 57
def read_multi_entries(keys, options)
  values = {}

  keys.each do |name|
    entry = read_entry(name, options)
    values[name] = entry.value if entry
  end

  values
end
write_entry(key, value, options) Show source
# File activesupport/lib/active_support/cache/strategy/local_cache.rb, line 68
def write_entry(key, value, options)
  @data[key] = value
  true
end

© 2004–2019 David Heinemeier Hansson
Licensed under the MIT License.