(1) Sign in redis:win+r,cmd, Input redis-cli( The following content indicates that the link is successful )(2) Locate the database :select Data can be numbered ,eg. select 1 ( Switch to db 1 This database )
( Two )Redis Basic knowledge explanation
(1) data type String numbers are special strings (String); Hash Dictionary (Hash); An ordered list is equivalent to Python Medium List(List); unordered set (Set); Ordered set (Zset)(2)Redis Common commands String The object operation ------ lookup :key[pattern]; Delete :del[key]; Check for presence :exists[key]; View key type :type[key]; Set the value :set key value; Value :get keyHash The object operation ------ Set the value :hset key field( key ) value( value ); Value :hget key fieldList The object operation ------ Insert... On the left :Ipush key value; Insert on the right :rpush key value; Set according to the index :Iset key index value; Left stack :Ipop key; Right out of the stack :Rpop keyset The object operation ( disorder , Can't repeat ): add to :sadd key member; Delete specified member:srem key member; see key All of the member:smembers key; Stack randomly count individual member:spop key count; Random check count individual member:srandmember key count; see key in member The number of :scard key;Zset The object operation :( Ordered set ; One key There will not be two identical member; Every member Corresponds to a unique score The weight , Do not put the high weight ahead of the low weight ; With the same weight member, Press the first insert on the left , The rear insert is on the right ; Default to heavy ) add to member and score:zadd key [score member]; Delete member:zrem key [member]; Delete by sort :zremrangebyrank key start stop; according to score Scope delete :zremrangebyscore key min max;
( 3、 ... and ) adopt python operation Redis database