Module: RedisStore::Cache::Rails3

Defined in:
lib/active_support/cache/redis_store.rb

Instance Method Summary collapse

Instance Method Details

#delete_matched(matcher, options = nil) ⇒ Object

Delete objects for matched keys.

Example:

cache.del_matched "rab*"


98
99
100
101
102
103
104
# File 'lib/active_support/cache/redis_store.rb', line 98

def delete_matched(matcher, options = nil)
  options = merged_options(options)
  instrument(:delete_matched, matcher.inspect) do
    matcher = key_matcher(matcher, options)
    @data.keys(matcher).each { |key| delete_entry(key, options) }
  end
end

#initialize(*addresses) ⇒ Object

Instantiate the store.

Example:

RedisStore.new
  # => host: localhost,   port: 6379,  db: 0

RedisStore.new "example.com"
  # => host: example.com, port: 6379,  db: 0

RedisStore.new "example.com:23682"
  # => host: example.com, port: 23682, db: 0

RedisStore.new "example.com:23682/1"
  # => host: example.com, port: 23682, db: 1

RedisStore.new "example.com:23682/1/theplaylist"
  # => host: example.com, port: 23682, db: 1, namespace: theplaylist

RedisStore.new "localhost:6379/0", "localhost:6380/0"
  # => instantiate a cluster


89
90
91
92
# File 'lib/active_support/cache/redis_store.rb', line 89

def initialize(*addresses)
  @data = ::Redis::Factory.create(addresses)
  super(addresses.extract_options!)
end