Class: Hydra::Keycloak::Store::RedisClient

Inherits:
Object
  • Object
show all
Extended by:
Mixin
Defined in:
lib/hydra/keycloak/store/redis_client.rb

Instance Method Summary collapse

Methods included from Mixin

args_inject, container, inject

Instance Method Details

#delete(key) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/hydra/keycloak/store/redis_client.rb', line 30

def delete(key)
  redis.del(key)

  Success(:ok)
rescue Redis::BaseError => e
  Failure(code: :redis_unavailable,
          context: { args: { key: key }, action: :delete, error: e.message, caller: caller })
end

#get(key) ⇒ Object



23
24
25
26
27
28
# File 'lib/hydra/keycloak/store/redis_client.rb', line 23

def get(key)
  Success(redis.get(key))
rescue Redis::BaseError => e
  Failure(code: :redis_unavailable,
          context: { args: { key: key }, action: :get, error: e.message, caller: caller })
end

#set(key, value) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/hydra/keycloak/store/redis_client.rb', line 14

def set(key, value)
  redis.set(key, value)

  Success(:ok)
rescue Redis::BaseError => e
  Failure(code: :redis_unavailable,
          context: { args: { key: key }, action: :set, error: e.message, caller: caller })
end