lib/economy/cache.rb in economy-4.0.0.0 vs lib/economy/cache.rb in economy-4.0.1.0

- old
+ new

@@ -1,26 +1,23 @@ module Economy class Cache def get(from, to) - client.get "exchanges/#{from.iso_code.downcase}/#{to.iso_code.downcase}" + redis.get "exchanges/#{from.iso_code.downcase}/#{to.iso_code.downcase}" end def set(exchange) - client.set "exchanges/#{exchange.from.downcase}/#{exchange.to.downcase}", exchange.rate.to_s + redis.set "exchanges/#{exchange.from.downcase}/#{exchange.to.downcase}", exchange.rate.to_s end def clear - client.del 'exchanges/*' + redis.del 'exchanges/*' end private - def client - @client ||= begin - require 'redis' - Redis.new url: Rails.configuration.redis_url - end + def redis + Economy.configuration.redis end end end