Class: VfrUtils::Cache
- Inherits:
-
Object
- Object
- VfrUtils::Cache
- Defined in:
- lib/vfr_utils/cache.rb
Instance Method Summary collapse
- #get(k, &blk) ⇒ Object
-
#initialize(config) ⇒ Cache
constructor
A new instance of Cache.
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 |