Class: VfrUtils::Cache

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Cache

Returns a new instance of Cache.



4
5
6
7
# File 'lib/vfr_utils/cache.rb', line 4

def initialize(config)
  @config = config
  init_redis
end

Instance Method Details

#get(k, &blk) ⇒ Object



9
10
11
12
13
# File 'lib/vfr_utils/cache.rb', line 9

def get(k, &blk)
   return get_files(k, &blk) if config.cache_backend == :files
   return get_redis(k, &blk) if config.cache_backend == :redis
   raise "Unsupported cache backend: #{config.cache_backend}"
end