Method: AnyCache::Adapters::Dalli#expire

Defined in:
lib/any_cache/adapters/dalli.rb

#expire(key, expires_in: DEAD_TTL) ⇒ void

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.

This method returns an undefined value.

Parameters:

  • key (String)
  • expires_in (Hash) (defaults to: DEAD_TTL)

    a customizable set of options

Options Hash (expires_in:):

  • (Integer)

Since:

  • 0.1.0



214
215
216
217
# File 'lib/any_cache/adapters/dalli.rb', line 214

def expire(key, expires_in: DEAD_TTL)
  is_alive = expires_in ? expires_in.positive? : false
  is_alive ? touch(key, expires_in) : driver.delete(key)
end