Class: Counter::Cache::Credis::RedisCli
- Inherits:
-
Object
- Object
- Counter::Cache::Credis::RedisCli
- Defined in:
- lib/counter/cache/credis/redis_cli.rb
Instance Method Summary collapse
-
#initialize ⇒ RedisCli
constructor
A new instance of RedisCli.
- #method_missing(meth, *args, &blk) ⇒ Object
Constructor Details
#initialize ⇒ RedisCli
Returns a new instance of RedisCli.
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 |