This article is to refer to the "Redis Chinese manual", the example code in PHP to implement, pay attention to the difference between Php-redis and REDIS_CLI (mainly return value type and parameter usage).
Directories (using the Ctrl+f Quick Find command):
Key |
String |
Hash |
List |
Set |
Key (key) DEL keys Randomkey TTL EXISTS move RENAME renamenx TYPE EXPIRE expireat OBJECT PERSIST SORT |
String (String) SET setnx Setex SETRANGE mset msetnx APPEND get mget getrange-getset STRLEN INCR incrby decr Decrby get BIT |
Hash (hash) hset hsetnx hmset hget hmget hgetall hdel hlen hexists hincrby hkeys hvals |
Table (list) Lpush lpushx rpush rpushx lpop rpop blpop brpop llen lrange lrem LSET LTRIM lindex linsert rpoplpush BRPOPLPUSH |
集合(Set) SADD SREM SMEMBERS SISMEMBER SCARD SMOVE SPOP SRANDMEMBER SINTER SINTERSTORE SUNION SUNIONSTORE SDIFF SDIFFSTORE |
|
Pub/sub |
Transaction |
Connection |
Server |
ordered set (Sorted set) zadd zrem zcard zcount zscore zincrby zrange zrevrange zrangebyscore zrevrange Byscore zrank zrevrank zremrangebyrank zremrangebyscore zinterstore zunionstore |
Publish/Subscribe (pub/sub) PUBLISH SUBS Cribe psubscribe |