Class: FayeTracking::RedisKeyList

Inherits:
AbstractKeyList show all
Defined in:
lib/faye_tracking/redis_key_list.rb

Instance Method Summary collapse

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

Returns:

  • (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

Returns:

  • (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