Module: RedisStore::Cache::Rails3
- Defined in:
- lib/active_support/cache/redis_store.rb
Instance Method Summary collapse
-
#delete_matched(matcher, options = nil) ⇒ Object
Delete objects for matched keys.
-
#initialize(*addresses) ⇒ Object
Instantiate the store.
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, = nil) = () instrument(:delete_matched, matcher.inspect) do matcher = key_matcher(matcher, ) @data.keys(matcher).each { |key| delete_entry(key, ) } 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.) end |