class ActiveSupport::Cache::RedisHash

Public Class Methods

new(*options) click to toggle source
Calls superclass method
# 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

Public Instance Methods

clear(options = nil) click to toggle source

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

# File lib/active_support/cache/redis_hash.rb, line 21
def clear(options = nil)
  @hash.destroy
end
read_multi(*names) click to toggle source

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

# File lib/active_support/cache/redis_hash.rb, line 15
def read_multi(*names)
  @hash[*names]
end

Protected Instance Methods

delete_entry(key, options) click to toggle source

Delete an entry from the cache.

# File lib/active_support/cache/redis_hash.rb, line 42
def delete_entry(key, options)
  @hash.delete(key)
end
read_entry(key, options) click to toggle source

Read an entry from the cache.

# File lib/active_support/cache/redis_hash.rb, line 28
def read_entry(key, options)
  @hash[key]
end
write_entry(key, entry, options) click to toggle source

Write an entry to the cache.

# File lib/active_support/cache/redis_hash.rb, line 33
def write_entry(key, entry, options)
  if options && options[:unless_exist]
    @hash.add(key, entry)
  else
    @hash[key] = entry
  end
end