Redis string Types Common command operations Access data
To save the string type data:
Take string type data:
Returns NULL when the key is not present
If you repeatedly save data to a key, the stored data overwrites the previously stored data
Increment number
When the stored string is in integer form, Redis provides a:
INCR command: To increment the current key value and return the incremented value
When the key value to increment does not exist, Redis will automatically deposit this key, the default value is 0, and increment the value
Name of the key
The key name Redis is not mandatory, and the general naming form is:
Object type: Object ID: Object property
For example: User:1:name Use this to store the name of the user with ID 1
Generate a self-increment ID
For example, each user generated a unique ID, the relational database setting ID field auto_increment to achieve
Object types can be used in Redis: Count for example (Users:count) stores the number of current object types without adding a
A new object, use the INCR command to increment the value of the key. INCR the initial value of the key value is 1, so the return of the INCR command
The value represents the total number of objects after the object is deposited, and can be used as the ID of the object.
Increase the specified integer
Incrby and INCR commands are basically the same, Incrby can specify an incremented value once:
Decrease the specified integer
DECR can make the values decrement
Decrby can specify how many values to subtract
Increase the specified floating point number
Add value to Tail
Get string length
Simultaneous storage gets multiple keys
Bit operation (temporarily not understand)
Redis Learning Notes (String Type Common command actions)