class Angus::Authentication::RedisClient

Constants

DEFAULT_NAMESPACE

Public Class Methods

new(settings) click to toggle source
# File lib/angus/authentication/redis_client.rb, line 10
def initialize(settings)
  settings = settings.dup
  @namespace = settings.delete(:namespace) || DEFAULT_NAMESPACE
  @settings = settings
end

Public Instance Methods

add_namespace(key) click to toggle source
# File lib/angus/authentication/redis_client.rb, line 28
def add_namespace(key)
  "#@namespace.angus-authentication-client.#{key}"
end
get_session_key(key) click to toggle source
# File lib/angus/authentication/redis_client.rb, line 20
def get_session_key(key)
  redis.get(add_namespace(key))
end
redis() click to toggle source
# File lib/angus/authentication/redis_client.rb, line 24
def redis
  @redis ||= Redis.new(@settings)
end
store_session_key(key, data) click to toggle source
# File lib/angus/authentication/redis_client.rb, line 16
def store_session_key(key, data)
  redis.set(add_namespace(key), data)
end