Class: ActiveSupport::Cache::Strategy::LocalCache::LocalStore
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: | |
| Instance Chain: | |
| Inherits: | ActiveSupport::Cache::Store 
 | 
| Defined in: | activesupport/lib/active_support/cache/strategy/local_cache.rb | 
Overview
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.
Constant Summary
::ActiveSupport::Cache::Store - Inherited
  
Class Attribute Summary
::ActiveSupport::Cache::Store - Inherited
Class Method Summary
Instance Attribute Summary
::ActiveSupport::Cache::Store - Inherited
| #logger, #options, | |
| #silence? | Alias for ActiveSupport::Cache::Store#silence. | 
Instance Method Summary
- #clear(options = nil)
- #delete_entry(key, **options)
- #read_entry(key, **options)
- #read_multi_entries(keys, **options)
- #write_entry(key, entry, **options)
::ActiveSupport::Cache::Store - Inherited
| #cleanup | Cleanups the cache by removing expired entries. | 
| #clear | Clears the entire cache. | 
| #decrement | Decrements an integer value in the cache. | 
| #delete | Deletes an entry in the cache. | 
| #delete_matched | Deletes all entries with keys matching the pattern. | 
| #delete_multi | Deletes multiple entries in the cache. | 
| #exist? | Returns  | 
| #fetch | Fetches data from the cache, using the given key. | 
| #fetch_multi | Fetches data from the cache, using the given keys. | 
| #increment | Increments an integer value in the cache. | 
| #mute | Silences the logger within a block. | 
| #read | Reads data from the cache, using the given key. | 
| #read_multi | Reads multiple values at once from the cache. | 
| #silence, | |
| #silence! | Silences the logger. | 
| #write | Writes the value to the cache, with the key. | 
| #write_multi | 
 | 
| #key_matcher | Adds the namespace defined in the options to a pattern designed to match keys. | 
Constructor Details
    .new  ⇒ LocalStore 
  
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 38
def initialize super @data = {} end
Instance Method Details
#clear(options = nil)
[ GitHub ]# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 48
def clear( = nil) @data.clear end
#delete_entry(key, **options)
[ GitHub ]# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 73
def delete_entry(key, **) !!@data.delete(key) end
#read_entry(key, **options)
[ GitHub ]# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 52
def read_entry(key, **) @data[key] end
#read_multi_entries(keys, **options)
[ GitHub ]# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 56
def read_multi_entries(keys, **) values = {} keys.each do |name| entry = read_entry(name, **) values[name] = entry.value if entry end values end
#write_entry(key, entry, **options)
[ GitHub ]# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 67
def write_entry(key, entry, **) entry.dup_value! @data[key] = entry true end