Redis PERSIST
PERSIST key
Redis PERSIST command is used to remove the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).
Syntax:
PERSIST KEY_NAME
Available since
2.2.0.
Return Value
-
Integer reply, specifically :
- 1, if the timeout is removed from the key.
- 0, if the key does not exist or does not have an associated timeout.
Return Value Type
Integer
Example: Redis PERSIST
First, create a key in redis and set some value in it.
127.0.0.1:6379[1]> SET key "JavaScript" OK 127.0.0.1:6379[1]> EXPIRE key 20 (integer) 1 127.0.0.1:6379[1]> TTL key (integer) 16 127.0.0.1:6379[1]> PERSIST key (integer) 1 127.0.0.1:6379[1]> TTL key (integer) -1 127.0.0.1:6379[1]> Get key "JavaScript"
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework