Class: CreditCardInfo::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/credit_card_info/cache.rb

Class Method Summary collapse

Class Method Details

.configObject



11
12
13
# File 'lib/credit_card_info/cache.rb', line 11

def self.config
  CreditCardInfo.config.cache
end

.fetch(code, &block) ⇒ Object



5
6
7
8
9
# File 'lib/credit_card_info/cache.rb', line 5

def self.fetch(code, &block)
  return yield unless config.provider

  config.provider.fetch("#{config.key_prefix}:#{code}", expires_in: config.ttl, &block)
end