Tag: false body failed string sudo set value execution log
Ubuntu installation Redis
[Email protected]:~$ sudo apt install redis-server[email protected]:~$ redis-server[email protected]:~$ redis-cli
Set (key, value, Ex=none, Px=none, Nx=false, Xx=false)
Set the value in Redis, not exist then create, overwrite if present
Ex is the value's expiration time in seconds
PX is the value of the expiration time in milliseconds
If NX is set to true, the current set operation is performed only if the key does not exist
XX If set to True, the current set operation is performed only if key exists
127.0.0.1:6379> set name johnok127.0.0.1:6379> get name # gets the value in name "John" 127.0.0.1:6379> set name Jackok127.0.0.1:6379> get name # overrides the original value "Jack" 127.0.0.1:6379> set age 2 # causes the value in age to survive for 2 seconds OK127.0.0.1 :6379> get Age "127.0.0.1:6379> get" (nil) # It's not worth the time to find the value 127.0.0.1:6379> set Live 2000 ms Ok127.0.0.1:6379> get Age "127.0.0.1:6379> get" (nil) # It's not worth the time to find the value. 127.0.0.1:6379> Set Name Jack NX # because name exists, so the set operation failed (nil) 127.0.0.1:6379> set name_1 Jack NX # because Name_1 does not exist, the set operation succeeds OK127.0.0.1 :6379> set name John xx # because name exists, so the set operation executes successfully ok127.0.0.1:6379> set name_1 John NX # because Name_1 does not exist, So the set operation failed to execute (nil)
String manipulation of Python-redis