module Redis::Commands::Keys

def expire(key, seconds, nx: nil, xx: nil, gt: nil, lt: nil)

Returns:
  • (Boolean) - whether the timeout was set or not

Parameters:
  • options (Hash) --
  • seconds (Integer) -- time to live
  • key (String) --
def expire(key, seconds, nx: nil, xx: nil, gt: nil, lt: nil)
  args = [:expire, key, Integer(seconds)]
  args << "NX" if nx
  args << "XX" if xx
  args << "GT" if gt
  args << "LT" if lt
  send_command(args, &Boolify)
end