Sha256: b000adec0d533d4be6ef21abe8dd20d75bf21851d6bf01340906686291d3f8d6
Contents?: true
Size: 945 Bytes
Versions: 1
Compression:
Stored size: 945 Bytes
Contents
require 'redis' class RedisUserConnector def self.get(key) connection.hgetall("#{namespace}:#{key}") end def self.set(key, *attrs) connection.hmset("#{namespace}:#{key}", *(attrs.flatten)) end def self.clean(key, field) connection.hdel("#{namespace}:#{key}", field) end def self.pub(channel, message) pubsub_connection.publish(channel, message) end def self.sub(channel, &block) pubsub_connection.subscribe(channel, &block) end private def self.connect_options connect_options = Settings['redis_user_connector'] raise "Error::Settings: <redis_user_connector> is undefined" if connect_options.nil? || connect_options.empty? connect_options.merge :driver => :hiredis end def self.connection @connection ||= Redis.new(connect_options) end def self.pubsub_connection @pubsub_connection ||= Redis.new(connect_options) end def self.namespace 'user' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
auth_redis_user_connector-0.0.9 | lib/auth_redis_user_connector/redis_user_connector.rb |