Class: FFlags::RedisClient

Inherits:
Object
  • Object
show all
Defined in:
lib/fflags/redis_client.rb

Overview

Redis Client

Instance Method Summary collapse

Instance Method Details

#all(key) ⇒ Object



11
12
13
# File 'lib/fflags/redis_client.rb', line 11

def all(key)
  client.hgetall(key)
end

#get(key, field) ⇒ Object



15
16
17
# File 'lib/fflags/redis_client.rb', line 15

def get(key, field)
  client.hget(key, field)
end

#reset(key) ⇒ Object



19
20
21
# File 'lib/fflags/redis_client.rb', line 19

def reset(key)
  client.del(key)
end

#set(key, field, value) ⇒ Object

hset doesn’t return explicitly true or false



5
6
7
8
9
# File 'lib/fflags/redis_client.rb', line 5

def set(key, field, value)
  return false if value.nil?

  client.hset(key, field, value.to_s)
end