module Redis::KeyHelper

Public Instance Methods

convert_key(key) click to toggle source
# File lib/redis/key_helper.rb, line 19
def convert_key(key)
  key.to_s
end
generate_key() click to toggle source
# File lib/redis/key_helper.rb, line 8
def generate_key
  t = Time.now
  t.strftime('%Y%m%d%H%M%S.') + t.usec.to_s.rjust(6,'0') + '.' + SecureRandom.hex(16)
end
key() click to toggle source
# File lib/redis/key_helper.rb, line 4
def key
  @key ||= generate_key
end
redis_key(key = nil, namespace = nil) click to toggle source
# File lib/redis/key_helper.rb, line 13
def redis_key(key = nil, namespace = nil)
  key       ||= self.key
  namespace ||= self.namespace
  namespace.nil? ? key : "#{namespace}:#{key}"
end