Class: Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/lamed/model.rb,
lib/lamed/redis.rb

Constant Summary collapse

REDIS_OPTIONS =
{
  :host    =>  $SYS_OPTIONS[:redis_host]     || '127.0.0.1' ,
  :port    => ($SYS_OPTIONS[:redis_port]    || 6379).to_i,
  :db      => ($SYS_OPTIONS[:redis_db]      || 0).to_i,
  :timeout => ($SYS_OPTIONS[:redis_timeout] || 5).to_i,
}

Instance Method Summary collapse

Constructor Details

#initialize(host, opts = {}) ⇒ Redis

Returns a new instance of Redis.



109
110
111
112
113
114
115
116
# File 'lib/lamed/model.rb', line 109

def initialize(host, opts={})
  @host    = host           || REDIS_OPTIONS[:host]
  @port    = opts[:port]    || REDIS_OPTIONS[:port]
  @db      = opts[:db]      || REDIS_OPTIONS[:db]
  @timeout = opts[:timeout] || REDIS_OPTIONS[:timeout]
  $debug   = opts[:debug]
  connect_to_server
end

Instance Method Details

#loadObject



118
119
# File 'lib/lamed/model.rb', line 118

def load
end