key features: key is a string, and the data saved in redis is obtained through key.
Command | Function |
---|---|
This command is used to delete the key when the key exists | |
Check whether the given key exists | |
Returns the type of value stored in key |
Function | |
---|---|
Set the expiration time for the given key in seconds | |
Set the expiration time of the key in milliseconds | |
EXPIREAT has a similar function to EXPIRE, and is used to set the expiration time for the key. The difference is that the time parameter accepted by the EXPIREAT command is UNIX timestamp (unix timestamp) | |
Set the timestamp of the key expiration time (unix timestamp) In milliseconds | |
In seconds, returns the remaining survival time of the given key | |
Return the remaining expiration time of the key in milliseconds | |
Remove the expiration time of the key, the key will be persisted |
3. Query mode
Function | |
---|---|
Query key |
Demonstration results:
4. Other operations
Function | |
---|---|
Rename the key | |
Only when newkey does not exist, rename the key to newkey |
two , Database general instructions
Function | |
---|---|
Switch database | |
Exit | |
Test connection |
##2. Related operations
move key db | |
---|---|
dbsize | |
flushdb | |
flushall | |
The above is the detailed content of How to apply Redis keys and common database instructions. For more information, please follow other related articles on the PHP Chinese website!