Method: Cash::Accessor::ClassMethods#decr
- Defined in:
- lib/cash/accessor.rb
#decr(key, delta = 1, ttl = nil) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/cash/accessor.rb', line 60 def decr(key, delta = 1, ttl = nil) ttl ||= cache_config.ttl repository.decr(cache_key = cache_key(key), delta) || begin repository.add(cache_key, (result = yield).to_s, ttl, true) { repository.decr(cache_key) } result end end |