Redis Linux installation unzip files tar zxxf redis-foldercd redis-foldercd src make install for ease of administration mkdir-p/usr/local/redis/bin Store command mkdir-p/usr/local/redis/etc store profile MV Src desc Move file mv mkreleasehdr.sh Redis-benchmark redis-check-aof R Edis-check-dump redis-cli redis-server /USR/LOCAL/REDIS/BIN&NBSP;CD. Return to previous directory ll enumerate current directory MV src Desc move source file into corresponding file Pkill redis-server Kill a Process vi src Open File Enter edit mode ZZ Save file and exit sudo su switch to root user & nbsp; first Introduction to NoSQL not only SQL, meaning anti-SQL motion NoSQL is a storage distributed in the form of Key-value: realize master-slave separation to ensure efficiency, The data is cached in memory, or it can periodically write updated data to disk or write modifications to the appended record file redis-server.exe redis.windows.conf start Redis Service Chapter II Redis data type string type is a binary secure data type set key Valueget keysetnx (set noe exist) key value does not overwrite metadata Setex set validity period SE Tex key_name Timeout Valuesetrange replace string setrange key_name index valuemset Multiple key value pairs set Mset key_name1 value key_name2 val Uegetset get old value set new value Getset key_name1 new_valuegetrange get substring getrange key_name1 index CountmGet gets multiple key value pairs mget key_name1 mget key_name2incr to an integer type increment operation, if a non-numeric string, you are prompted out of range incr Key_nameincrby to set the self-increment quantity Incrby key_name countdecr decrbyappend Append string append key_name append_valuestrlen take string length strlen key_name The hashes type is more suitable for storing an object and can consume less memory hset myhash field1 valuehset myhash field2 valuehset myhash field3 valuehget Myhash field1hget myhash field2hsetnx myhash field1 valuehmset myhash field1 value field2 Valuehincrby myhash field1 Count Hexist Myhash field1 determine if a field in the hash table exists Hlen Myhash get the number of fields in the hash table Hdel Myhash delete a field in the hash table Hkeys Myhahs returns all fields in the hash hget All gets the hash of all key value pairs of lists type linked list structure, either as a stack or as a queue lpush mylist valuelrange mylist 0-1 & nbsp &NBSP;0 represents the first element from the beginning, 1 means the first element is started from the tail Rpush mylist value is pressed from the tail into the linked list Linsert mylist before field value insert LSet before a value Setting the set specifies that the elements of the following table are replaced by Lrem mylist n value deletes the current list of n value values,n> 0 means delete from the beginning, n<0 means to remove LTrim mylist from the tail lpop mylist the elements between N and M elements. Section removes an element Rpoplpush Mylist1 mylistTrailing remove put put into Lindex mylist index returns the value of subscript index Llen returns the number of list set type unordered collection collection type, no duplicate values, Hashtable set value add element Srem Set Value Delete element Spop set random Popup collection element Sdiff Set1 Set2 Returns the difference set of two sets Sdiff Set1 Set2 Set3 Inserts a difference set of two sets into the third collection Sinter Set1 Set2 return Intersection of two sets sinter sore Set1 Set2 set3sunion Set1 Set2 and set Sunionstore set1 set2 set3smove set1 set2 mumber move Set1 Muber members into Set2 , and delete SCard Set1 returns the number of sets Sismumber set mumber determine whether an element is an element of the collection Srandmember randomly returns an element in the collection, but does not delete the sorted set Ordered set alias Zsetmysql two list, one column with value, one column Sort redis key command keys * Current database all Keykeys my* return keyexists key with my Determine if the current library exists with a Keydel key delete a Keyexpire key set expiration time for a key select 0-15 bids a database, 0 for the No. 0 database move key 1 means to move the current key into the first database PE Rsist key cancels expiration time Randomkey randomly returns a keyrename in the database key_name new_key_name Rename type key returns the data type of key ping returns pong indicates Redis connection normal echo Key on command line output quit quit connection Dbsize returns the number of keys in the current database info get server information and statistics FLUSHDB Delete all keyflushall of the current database delete all the databases key auth Password Authorization password redis data persistence snapshot aof snapshot and aof combination Virtual memory, which is to put infrequently used data into disk
Redis Common Directives