string
- SET
stores a string value.
SET key value [NX | XX] [GET] [EX seconds | PX milliseconds |
EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL]
KEEPTTL: 用于在应用 SET 命令设置键的值时,保留键的 TTL(Time To Live)信息。当你应用 SET 命令来更新一个曾经存在的键时,默认状况下会重置键的 TTL,也就是键的生存工夫会被从新计算。然而如果你心愿保留原有的 TTL,能够应用 KEEPTTL 选项。
- SETEX
等价于 SET key value EX seconds
- PSETEX
PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds. 跟 SETEX 相似,区别就是这个是毫秒。
- SETNX
stores a string value only if the key doesn’t already exist. Useful for implementing locks.
- GET
retrieves a string value.
- GETDEL
Get the value of key and delete the key.
- GETSET
Atomically sets key to value and returns the old value stored at key.
- GETEX
Get the value of key and optionally set its expiration. 获取键的值,并且同时能够为该键设置新的过期工夫
- MGET
retrieves multiple string values in a single operation.
- SUBSTR
SUBSTR key start end
Returns the substring of the string value stored at key. 当初已被弃用,不举荐在新的应用程序中应用。相同,您应该应用 GETRANGE 命令来执行相似的操作
- GETRANGE
GETRANGE key start end
Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).
- STRLEN
Returns the length of the string value stored at key.
- APPEND
APPEND key value
If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.
- INCR
Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64 bit signed integers.
- DECR
- INCRBY
- DECRBY
- INCRBYFLOAT
- DECRBYFLOAT