RedisSetCommandExpiration

public struct RedisSetCommandExpiration : Hashable

The expiration to apply when setting a key.

See https://redis.io/commands/set

  • Retain the existing expiration associated with the key, if one exists.

    Redis documentation refers to this as “KEEPTTL”.

    Important

    This is option is only available in Redis 6.0+. An error will be returned if this value is sent in lower versions of Redis.

    Declaration

    Swift

    public static let keepExisting: RedisSetCommandExpiration
  • Expire the key after the given number of seconds.

    Redis documentation refers to this as the option “EX”.

    Important

    The actual amount used will be the specified value or 1, whichever is larger.

    Declaration

    Swift

    public static func seconds(_ amount: Int) -> RedisSetCommandExpiration
  • Expire the key after the given number of milliseconds.

    Redis documentation refers to this as the option “PX”.

    Important

    The actual amount used will be the specified value or 1, whichever is larger.

    Declaration

    Swift

    public static func milliseconds(_ amount: Int) -> RedisSetCommandExpiration