Module: YAVDB::Utils::Cache
- Defined in:
- lib/yavdb/utils/cache.rb
Constant Summary collapse
- CACHE_MAIN_KEY =
'general'
Class Method Summary collapse
Class Method Details
.cache_contents(group_key, key, &body) ⇒ Object
28 29 30 |
# File 'lib/yavdb/utils/cache.rb', line 28 def self.cache_contents(group_key, key, &body) get(group_key, key) || put(group_key, key, body.call) end |
.cache_path(group_key, key, &body) ⇒ Object
32 33 34 35 36 |
# File 'lib/yavdb/utils/cache.rb', line 32 def self.cache_path(group_key, key, &body) key_path = generate_cache_identifier(group_key, key) body.call(key_path) unless File.exist?(key_path) key_path end |