Module: Taro::Cache
- Defined in:
- lib/taro/cache.rb
Instance Attribute Summary collapse
-
#cache_instance ⇒ Object
Returns the value of attribute cache_instance.
Class Method Summary collapse
Instance Attribute Details
#cache_instance ⇒ Object
Returns the value of attribute cache_instance.
2 3 4 |
# File 'lib/taro/cache.rb', line 2 def cache_instance @cache_instance end |
Class Method Details
.call(object, cache_key: nil, expires_in: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/taro/cache.rb', line 4 def self.call(object, cache_key: nil, expires_in: nil) case cache_key when nil yield when Hash, Proc call(object, cache_key: cache_key[object], expires_in: expires_in) { yield } else cache_instance.fetch(cache_key, expires_in: expires_in) { yield } end end |