tencent cloud


Last updated: 2020-12-25 16:40:13


    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.


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


    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.


    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.


    Query the TTL of a record:

    tcaplus> getttl from mails where key1 = 1 and key2 = "abc";
    The time to live is 2000 milliseconds.
    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 avaliable.

    7x24 Phone Support