module CcyConvertor::RateCache
Attributes
cache_duration[W]
Public Instance Methods
cache()
click to toggle source
# File lib/ccy_convertor/rate_cache.rb, line 5 def cache @cache ||= {} @cache[rate_provider_name] ||= ActiveSupport::Cache::MemoryStore.new(expires_in: cache_duration) end
cache_duration()
click to toggle source
# File lib/ccy_convertor/rate_cache.rb, line 10 def cache_duration @cache_duration ||= if cache_duration_nil? 0 else CcyConvertor.configuration.cache_duration[rate_provider_name] end end
cache_duration_nil?()
click to toggle source
# File lib/ccy_convertor/rate_cache.rb, line 18 def cache_duration_nil? @cache_duration.nil? && (CcyConvertor.configuration.cache_duration.nil? || CcyConvertor.configuration.cache_duration[rate_provider_name].nil?) end
cache_key(request_url)
click to toggle source
# File lib/ccy_convertor/rate_cache.rb, line 24 def cache_key(request_url) Digest::SHA2.hexdigest request_url end