Module: Philiprehberger::CacheKit::Batch
- Included in:
- Store
- Defined in:
- lib/philiprehberger/cache_kit/batch.rb
Overview
Batch operations for Store.
Instance Method Summary collapse
-
#get_many(*keys) ⇒ Hash
Retrieve multiple keys in a single lock acquisition.
Instance Method Details
#get_many(*keys) ⇒ Hash
Retrieve multiple keys in a single lock acquisition. Returns only found (non-nil, non-expired) entries, skipping misses.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/philiprehberger/cache_kit/batch.rb', line 12 def get_many(*keys) keys = keys.flatten @mutex.synchronize do result = {} keys.each do |key| value = fetch_entry(key) result[key] = value unless value.nil? end result end end |