
- 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 Pexpire Command
Redis Pexpire command is used to set the expiry of the key in milliseconds. After the expiry time, the key will not be available in Redis.
Return Value
Integer value 1 or 0
- 1, if the timeout is set for the key.
- 0, if the key does not exist or timeout could not be set.
Syntax
Following is the basic syntax of Redis Expire command.
redis 127.0.0.1:6379> PEXPIRE KEY_NAME TIME_IN_MILLISECONDS
Example
First, create a key in Redis and set some value in it.
redis 127.0.0.1:6379> SET tutorialspoint redis OK
Now, set timeout of the previously created key.
redis 127.0.0.1:6379> PEXPIRE tutorialspoint 5000 (integer) 1
In the above example, 5 seconds time is set for the key tutorialspoint. After 5 seconds, the key will expire automatically.
redis_keys.htm
Advertisements