Hi Team,
I have set keys with particular ttl. How do I query how much time is remaining for the key to expire? I am using the Go client.
Hi Team,
I have set keys with particular ttl. How do I query how much time is remaining for the key to expire? I am using the Go client.
It should be on any record you’ve pulled already, you just need to access it (either the entire record or just the header). I’m not familiar with the GO API but here are some references
func (*Client) Get func (clnt *Client) Get(policy *BasePolicy, key *Key, binNames …string) (*Record, error) Get reads a record header and bins for specified key. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) GetHeader func (clnt *Client) GetHeader(policy *BasePolicy, key *Key) (*Record, error) GetHeader reads a record generation and expiration only for specified key. Bins are not read. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
type Record struct { // Key is the record’s key. // Might be empty, or may only consist of digest value. Key *Key
// Node from which the Record is originating from.
Node *Node
// Bins is the map of requested name/value bins.
Bins BinMap
// Generation shows record modification count.
Generation uint32
// Expiration is TTL (Time-To-Live).
// Number of seconds until record expires.
Expiration uint32
}
So the expiration will be in the record…