Instance Method
expire(_:after:)
Sets a timeout on key. After the timeout has expired, the key will automatically be deleted.
func expire(_ key: RedisKey, after timeout: TimeAmount) async throws -> Bool
Parameters
keyThe key to set the expiration on.
timeoutThe time from now the key will expire at.
Return Value
true if the expiration was set.
Discussion
Note
A key with an associated timeout is often said to be “volatile” in Redis terminology.
https://redis.io/commands/expire