Method: Redstruct::Struct#expire

Defined in:
lib/redstruct/struct.rb

#expire(ttl) ⇒ Boolean

Sets the key to expire after ttl seconds

Parameters:

  • ttl (#to_f)

    the time to live in seconds (where 0.001 = 1ms)

Returns:

  • (Boolean)

    true if expired, false otherwise



33
34
35
36
# File 'lib/redstruct/struct.rb', line 33

def expire(ttl)
  ttl = (ttl.to_f * 1000).floor
  return coerce_bool(self.connection.pexpire(@key, ttl))
end