Sha256: fe21f30a7a5b1abd2e98978ed49c026e0e2937cc6f179e5af0ef1793f1d03b24

Contents?: true

Size: 401 Bytes

Versions: 1

Compression:

Stored size: 401 Bytes

Contents

module Economy
  class Cache

    def get(from, to)
      redis.get "exchanges/#{from.iso_code.downcase}/#{to.iso_code.downcase}"
    end

    def set(exchange)
      redis.set "exchanges/#{exchange.from.downcase}/#{exchange.to.downcase}", exchange.rate.to_s
    end

    def clear
      redis.del 'exchanges/*'
    end

    private

    def redis
      Economy.configuration.redis
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
economy-4.0.1.0 lib/economy/cache.rb