- 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 Persist Command
Redis PERSIST command is used to remove the expiration from the key.
Return Value
Integer value 1 or 0
- 1, if timeout is removed from the key.
- 0, if the key does not exist or does not have an associated timeout.
Syntax
Following is the basic syntax of Redis PERSIST command.
redis 127.0.0.1:6379> PERSIST KEY_NAME
Example
First, create a key in Redis and set some value in it.
redis 127.0.0.1:6379> SET tutorial1 redis OK
Now, set the expiry of the key, and later remove the expiry.
redis 127.0.0.1:6379> EXPIRE tutorial1 60 1) (integer) 1 redis 127.0.0.1:6379> TTL tutorial1 1) (integer) 60 redis 127.0.0.1:6379> PERSIST tutorial1 1) (integer) 1 redis 127.0.0.1:6379> TTL tutorial1 1) (integer) -1
redis_keys.htm
Advertisements