Skip to main content

PTTL

Syntax

PTTL key

Module

generic

Categories

fast keyspace read

Description

Returns the remaining time to live for a key that has an expiry time in milliseconds. If the key exists but does not have an associated expiry time, -1 is returned. If the key does not exist, -2 is returned.

Examples

Retrieve the expiration time of a key:

vault, err := echovault.NewEchoVault()
if err != nil {
log.Fatal(err)
}
ttl, err := vault.PTTL("key")