tencent cloud

All product documents
TencentDB for TcaplusDB
Last updated: 2024-12-04 10:12:05
getttl
Last updated: 2024-12-04 10:12:05

Overview

This command is used to query the Time to Live (TTL) in millisecond of a record. After a record is configured with TTL, you can use getttl to query the TTL of its key, that is, how long it is until the key is removed due to expiration. This command can query the TTL of only one record.

Syntax

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

Parameters

Parameter
Required
Use Limits
Description
table
Yes
None
Table name
key in the WHERE clause
Yes
TDR table: all key values are required
Specify the value of a key. Multiple values are separated with and.

Errors

For more information, please see Error Codes.

Return Messages

Situation
Return Message
The key does not exist or has expired.
Record does not exist or has expired.
The key exists but its TTL is not specified.
Record exists and no expiration time is set (permanent).
Failed to query the TTL.
Failed to get time to live. The error code is [error code] and the error message is [Error message].
Queried the TTL successfully.
The time to live is [TTL] milliseconds.

Sample

Query the TTL of a record:
tcaplus> getttl from mails where key1 = 1 and key2 = "abc";
The time to live is 2000 milliseconds.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon