module Razoul::Persistence::Redis
Constants
- DB
- HOST
- PORT
Public Class Methods
configure(class_name, config)
click to toggle source
# File lib/razoul/persistence/redis.rb, line 10 def configure(class_name, config) class_name.new(hash_config_attrs(config)) end
find(conn, key)
click to toggle source
# File lib/razoul/persistence/redis.rb, line 18 def find(conn, key) conn.get(key) end
hash_config_attrs(config)
click to toggle source
# File lib/razoul/persistence/redis.rb, line 22 def hash_config_attrs(config) hash = {} constants.map do |const| value = config.has_attr?("#{self.class.name}_#{const.downcase}") ? config.send("#{self.class.name}_#{const.downcase}") : const_get(const) hash.merge!(const.downcase.to_sym => value) end hash end
save(conn, key, value)
click to toggle source
# File lib/razoul/persistence/redis.rb, line 14 def save(conn, key, value) conn.set(key, value).eql?('OK') ? true : false end