- Redis Basics
- Redis - Home
- Redis - Overview
- Redis - Environment
- Redis - Configuration
- Redis - Data types
- Redis Commands
- Redis - Commands
- Redis - Keys
- Redis - Strings
- Redis - Hashes
- Redis - Lists
- Redis - Sets
- Redis - Sorted Sets
- Redis - HyperLogLog
- Redis - Publish Subscribe
- Redis - Transactions
- Redis - Scripting
- Redis - Connections
- Redis - Server
- Redis Advanced
- Redis - Backup
- Redis - Security
- Redis - Benchmarks
- Redis - Client Connection
- Redis - Pipelining
- Redis - Partitioning
- Redis - Java
- Redis - Php
- Redis Useful Resources
- Redis - Quick Guide
- Redis - Useful Resources
- Redis - Discussion
Redis - Keys Pttl Command
Redis PTTL command is used to get the remaining time of the key expiry in milliseconds.
Return Value
Integer value TTL in milliseconds, or a negative value.
- TTL in milliseconds.
- -1, if the key does not have an expiry timeout.
- -2, if the key does not exist.
Syntax
Following is the basic syntax of Redis PTTL command.
redis 127.0.0.1:6379> SET tutorialname redis OK
Example
First, create a key in Redis and set some value in it.
redis 127.0.0.1:6379> SET tutorialname redis OK
Now set the expiry of the key, and later check the remaining expiry time.
redis 127.0.0.1:6379> EXPIRE tutorialname 1 1) (integer) 1 redis 127.0.0.1:6379> PTTL tutorialname 1) (integer) 999
redis_keys.htm
Advertisements