Class: Counter::Cache::Credis::RedisCli

Inherits:
Object
  • Object
show all
Defined in:
lib/counter/cache/credis/redis_cli.rb

Instance Method Summary collapse

Constructor Details

#initializeRedisCli



6
7
8
9
10
11
12
13
14
# File 'lib/counter/cache/credis/redis_cli.rb', line 6

def initialize
  config = YAML.load_file("./config/redis.yml")[Rails.env]
  if config
    @redis ||= Redis.new(:host => config['redis_host'], :port => config['redis_port'],
                        namespace: config['redis_namespace'], :db => config['redis_db'])
  else
    @redis ||= Redis.new
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object



16
17
18
# File 'lib/counter/cache/credis/redis_cli.rb', line 16

def method_missing(meth, *args, &blk)
  @redis.send(meth, *args,  &blk)
end