Class: ActiveSupport::Cache::RedisHash

Inherits:
Store
  • Object
show all
Defined in:
lib/active_support/cache/redis_hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ RedisHash

Returns a new instance of RedisHash.



6
7
8
9
10
11
# File 'lib/active_support/cache/redis_hash.rb', line 6

def initialize(*options)
  options = options.extract_options!
  super(options)
  @hash = ::Redis::BigHash.new(options[:key], options[:namespace] || :rails_cache)
  extend Strategy::LocalCache
end

Instance Method Details

#clear(options = nil) ⇒ Object

Clear the entire cache on server. This method should be used with care when shared cache is being used.



21
22
23
# File 'lib/active_support/cache/redis_hash.rb', line 21

def clear(options = nil)
  @hash.destroy
end

#read_multi(*names) ⇒ Object

Reads multiple values from the cache using a single call to the servers for all keys.



15
16
17
# File 'lib/active_support/cache/redis_hash.rb', line 15

def read_multi(*names)
  @hash[*names]
end