String type
Set
Setnx
Setex
SETRANGE substring Range string
Mset
Msetnx
Msetex
Get
Getnx if not added returns 0 if there is no add
GetEx if not added if there is, replace returns the original value
Mget Batch
GetRange
Append stitching
strlen string length
INCR self-increment
Incrby Specify the self-increment
DECR Self-reduction
Decrby Specify self-decrement
Hashe type
Hset user:001 name Lijie
Hget
Hsetnx
Hmset
Hincr
Hincrby
Hexists
Hlen
Hdel
Hkeys return all see keys
Hvals
Hgetall
Lists type
Lpush adding elements to the head
Rpush Tail add element queue
Linsert specified position x before x x
LSet Specifying subscript elements
Lrem deletes the same element of N value from the key corresponding list.
LTrim remove all other elements after taking the range
Lpop removes the element from the head of the list and returns the deleted element
Rpop removes the element from the tail of the list and returns the deleted element
Lrange 0-1 from beginning to end ()
Rpoplpush removes an element from the first list tail and adds it to the head of the second list
Lindex returns the element of the index position in the list named key
Llen
Sets type
Hash table
Sadd Add 1 0
Smembers View
Srem
Spop Random Popup
Sdiff Collection Difference Set
Sdiffstore Set and Store
Sinter intersection
Sinterstore intersect and store
Sunion and Class
Sunionstore
Smove elements of the first collection move to the second collection
SCard Number of collections
Sismembers determines whether an element is a collection element
Srandmember randomly fetching elements
Zset Type ordered Collection
Zadd zadd myzset 1 "one"
Zrange Withsoures
Zrem
Zincrby Increment for order designation
Zrank Sort return Index small-〉 large
Zrevrank large to small descending returns the index position
Zrevrange Descending
Zrangebyscore deleted in sequential range
Zcount number of intervals
Number of Zcard
Zremrangbyrank Delete by index
——————————————————————————————————————————————————————
Health value
Fuzzy matching
Keys * Return to all health
exists exists 1 does not exist 0
Del Delete succeeded 1 unsuccessful 0
Expire Setting the Expiration time
TTL gets key valid at times
Select Database
Persist cancellation If the expiration time has been canceled return-1
Randomkey Random Return key
Rename renaming
Type returns the key types X
_______________________________________________________________________________________________________________ ___________________________
Server-related commands
Ping tests if the connection is alive
Echo
Select 0-15
Quit
Dbsize returns the number of keys in the current database
Info Redis Information
Config get returns the value of the related configuration
FLUSHDB Delete all keys in the currently selected database
Flushall Delete all
————————————————————————————————————————————————————————
Advanced Applications
Security:
Requirepass Beijing
Auth Authorization
redis-cli-a Password
Slave
Master multiple SLAve, can also be connected to other slave
Slave to slave connection to avoid master downtime heartbeat
Slave server Add slaveof 192.168.1.1 6379# Specify the IP and port of master
Masterauth tamp# The password of the primary server
Things:
Mulit
Set x XX
Discard emptying queue things rollback
Exec
Redis common commands partial collation and meaning