Class: FayeTracking::RedisKeyList
- Inherits:
-
AbstractKeyList
- Object
- AbstractKeyList
- FayeTracking::RedisKeyList
- Defined in:
- lib/faye_tracking/redis_key_list.rb
Instance Method Summary collapse
- #add(key, value) ⇒ Object
- #empty?(key) ⇒ Boolean
-
#initialize(redis) ⇒ RedisKeyList
constructor
A new instance of RedisKeyList.
- #member?(key, value) ⇒ Boolean
- #members(key) ⇒ Object
- #remove(key, value) ⇒ Object
- #remove_all(key) ⇒ Object
Constructor Details
#initialize(redis) ⇒ RedisKeyList
Returns a new instance of RedisKeyList.
3 4 5 |
# File 'lib/faye_tracking/redis_key_list.rb', line 3 def initialize(redis) @redis = redis end |
Instance Method Details
#add(key, value) ⇒ Object
7 8 9 |
# File 'lib/faye_tracking/redis_key_list.rb', line 7 def add(key, value) @redis.sadd key, value end |
#empty?(key) ⇒ Boolean
23 24 25 |
# File 'lib/faye_tracking/redis_key_list.rb', line 23 def empty?(key) @redis.smembers(key).empty? end |
#member?(key, value) ⇒ Boolean
15 16 17 |
# File 'lib/faye_tracking/redis_key_list.rb', line 15 def member?(key, value) @redis.sismember key, value end |
#members(key) ⇒ Object
19 20 21 |
# File 'lib/faye_tracking/redis_key_list.rb', line 19 def members(key) @redis.smembers key end |
#remove(key, value) ⇒ Object
11 12 13 |
# File 'lib/faye_tracking/redis_key_list.rb', line 11 def remove(key, value) @redis.srem key, value end |
#remove_all(key) ⇒ Object
27 28 29 |
# File 'lib/faye_tracking/redis_key_list.rb', line 27 def remove_all(key) @redis.del(key) end |