lib/counter/cache/credis/redis_cli.rb in counter-cache-credis-0.0.5 vs lib/counter/cache/credis/redis_cli.rb in counter-cache-credis-0.0.6

- old
+ new

@@ -1,21 +1,20 @@ module Counter module Cache module Credis class RedisCli - 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 + config = YAML.load_file("./config/redis.yml")[Rails.env] + + if config + REDISCLI = Redis.new(:host => config['redis_host'], :port => config['redis_port'], + namespace: config['redis_namespace'], :db => config['redis_db']) + else + REDISCLI = Redis.new end def method_missing(meth, *args, &blk) - @redis.send(meth, *args, &blk) + REDISCLI.send(meth, *args, &blk) end end end end \ No newline at end of file