The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

getttl

Last updated: 2024-10-15 17:40:26

Introduction

Users can call the getttl command to retrieve the Time To Live (TTL) of a record. After setting a TTL for a record, users can use the getttl command to check the remaining TTL (in milliseconds), which indicates how long it will be before the key is removed due to expiration. The getttl command only applies to a single record and does not support multiple records.

Syntax

getttl from [table] where key1 = 1 and key2 = "abc";

Parameters

Parameters
Required or Not
limitation factor
Description
table
Yes
No
Table Name
where clause's key
Yes
For TDR tables, all key values must be provided
Declare the key value. Use 'and' to connect multiple key values

Errors

Please refer to the error code list.

Returning Message

Situation Description
Returning Message
keys do not exist or have expired
Record does not exist or has expired.
keys exist and do not have an expiration time (Permanent Validity)
Record exists and no expiration time is set (permanent).
Retrieve Failed
Failed to get time to live. The error code is [error code] and the error message is [Error message].
Retrieve Success
The time to live is [TTL] milliseconds.

Example

Retrieve the TTL of a specific record:
tcaplus> getttl from mails where key1 = 1 and key2 = "abc";
The time to live is 2000 milliseconds.