123456789_123456789_123456789_123456789_123456789_

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.

Class Attribute Summary

::ActiveSupport::Cache::Store - Inherited

.instrument

:deprecated:

.instrument=

:deprecated:

.logger

Class Method Summary

::ActiveSupport::Cache::Store - Inherited

.new

Create a new cache.

Instance Attribute Summary

Instance Method Summary

::ActiveSupport::Cache::Store - Inherited

#cleanup

Cleanup the cache by removing expired entries.

#clear

Clear the entire cache.

#decrement

Decrement an integer value in the cache.

#delete

Deletes an entry in the cache.

#delete_matched

Delete all entries with keys matching the pattern.

#exist?

Returns true if the cache contains an entry for the given key.

#fetch

Fetches data from the cache, using the given key.

#fetch_multi

Fetches data from the cache, using the given keys.

#increment

Increment an integer value in the cache.

#mute

Silence the logger within a block.

#read

Fetches data from the cache, using the given key.

#read_multi

Read multiple values at once from the cache.

#silence,
#silence!

Silence the logger.

#write

Writes the value to the cache, with the key.

Constructor Details

.newLocalStore

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 37

def initialize
  super
  @data = {}
end

Instance Method Details

#clear(options = nil)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 47

def clear(options = nil)
  @data.clear
end

#delete_entry(key, options)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 60

def delete_entry(key, options)
  !!@data.delete(key)
end

#read_entry(key, options)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 51

def read_entry(key, options)
  @data[key]
end

#write_entry(key, value, options)

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/strategy/local_cache.rb', line 55

def write_entry(key, value, options)
  @data[key] = value
  true
end