Redis Keys: MOVE
MOVE key db
Redis MOVE command is used to move a key from currently selected database to specified destination database. When key already exists in the destination database, or it does not exist in the source database, it does nothing. It is possible to use MOVE as a locking primitive because of this.
MOVE KEY_NAME DESTINATION_DATABASE
Integer reply , specifically
- 1, if the key is moved.
- 0, if the key is not moved.
Return Value Type
Example: Redis MOVE
First, create a key in redis and set some value in it.
In redis by default 0th database is selected, so now we are moving the generated key in the second database.
127.0.0.1:6379> SET key "PHP" OK 127.0.0.1:6379> MOVE key 1 (integer) 1 127.0.0.1:6379> MOVE key 1 (integer) 0
Example: Redis MOVE another example
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join