Method: AnyCache::Adapters::Redis#decrement
- Defined in:
- lib/any_cache/adapters/redis.rb
#decrement(key, amount = DEFAULT_INCR_DECR_AMOUNT, **options) ⇒ NillClass, Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/any_cache/adapters/redis.rb', line 210 def decrement(key, amount = DEFAULT_INCR_DECR_AMOUNT, **) expires_in = .fetch(:expires_in, NO_EXPIRATION_TTL) new_amount = nil pipelined do new_amount = decrby(key, amount) expire(key, expires_in: expires_in) if expires_in end new_amount&.value end |