The second operation command redis Common Interface

          redis There are five types of data, covering all the scenes business applications, including string (string), list (list), hash (key-value pairs), set (collection), zSet (ordered set).
    If it is java development who these five data types must be very familiar with, but these five data classes and java does not like this, will know the specific different reasons behind the study.
    Redis has a wealth of operational command.
    String Type Command Operation:
        (. 1) SET key value / GET key set / get the key-value
        (2) GetSet key value set key-value while the return value of the value
        (3) incr / decr key the key corresponding to the value value plus or a minus one, if the key does not exist, then the initial value of 0
        (. 4) incrby INCREMENT key corresponding to the key value plus value INCREMENT, if the type is a string, an error is returned
        (5) decrby key decrement value corresponding to the key value Save Decrement, if the type is a string, an error is returned
        (6) setex key seconds value set key failed after seconds seconds
        (7) on the value of the append key value in the key value corresponding to splice value
        (. 8) acquired key key strlen corresponding to the length of the string
        (9) mset key value key value / mget key key and set / get a plurality of key-value pairs
    List Type Command Operation:
        (. 1) LPUSH / RPUSH key value corresponding to the key value in the list list head / tail is inserted into a plurality of elements value, if the key does not exist, create key
        (2) lpushx / rpushx key value corresponding to the key value in the list list head / tail insert element value, if the key does not exist no operation
        (3) lpop / rpop key extraction key a corresponding list element list head / tail
        (4) lrange key start stop key corresponding to the query list element from start to stop list, query the entire list 0 = start, stop -1 =
        (. 5) LLEN key query key corresponding to the length of the list of the list
        (6) lrem key count value to delete the specified element value key corresponding to the list in the linked list,
            COUNT> 0 from the beginning traversal deleted, count <0 traversal starts deleted from the tail, value for the specified element
        (7) ltrim key start stop retaining only the elements between start and stop, delete the entire other
        between (8) lset key index value index index is value, index key can only be the length of the range (0 ~ llen key - 1 )
        (9) lindex key index acquires index index value corresponds with the
        front / rear (10) linsert key AFTER / BEFORE PROVI value in the key corresponding list the list provi element inserted value element
        (11) rpoplpush source destination extracted source corresponding list list the last element, into a head destination
    hash type command operation:
        (. 1) key field value HSET / hget key field set / get the key field corresponding to the field value corresponding to
        (2) hexists key field determines whether there is a field field
        ( 3) hlen key acquired length of the map corresponding to key
        (4) hdel key field delete field field
        (5) hsetnx key field only if the field field does not exist, add fields field
        (. 6) hincrby key field increment field field by increment of value
        hgetall (7) key-value accessories Field
        (. 8) hkeys acquired all the key set
        (9) hvals acquired together all of val
        (10) hmset key [field value ...] / hmget [key ...] or a store-value acquiring a plurality Filed
    the Set Type Command Operation:
        increasing (1) key member1 member2 set corresponding to the key element, if the key It does not exist, create it
        (2) scard key acquisition key corresponding to the number of the sets of elements
        (3) sismember key member determines whether the key is a collection of member element
        (4) smembers key acquisition key corresponding to all the elements in the collection
        (5) spop key Removes the key corresponding to a random collection member
        (6) srem key member1 member2 delete the specified elements in the set
        (7) srandmember key count acquired random key set count number of elements, but does not delete the element
        (8) smov source destination member the element member into the destination set from the source
        (9) sdiff key1 key2 key3 query each set to obtain a difference current
        (10) sdiffstore destination key1 key2 key3 query each set have a difference-set and stored in the destination set, overwrites the original destination member
        (11) sinter key1 key2 key3 the intersection of each set of query
        (12) sinterstore destination key1 key2 queries and stored in each set was the intersection of destination, the destination will overwrite the existing members of the
        (13) sunion key1 key2 key3 each set of query and set
        (14) of each set of query sunion destination key1 key2 key3 of obtained and set and stored
    zSet type command operation:
        (. 1) Zadd Key score member add elements, score fractional element, if increased, the score of an element already exists, the score of this member is updated to the new value
        (2) zcard See obtained key number set key element
        (3) zcount key min max number of acquired points between the min and max of the element
        (4) zscore key member obtain fraction member elements
        (5) zincrby key increment member will increase the score elements INCREMENT
        (. 6) Z range the STOP Key Start acquired elements between the stop start, if the stop = -1, start = 0 is acquired all
        list elements (7) zrevrange key start stop acquiring position in a range of small to large sorting
        (8) zrangebyscore key min max score acquired within the specified range of elements
        (9) zrevrangebyscore key max min acquired scores within the specified range of elements, and descending order based on the score
        (10) zrank key member acquired ranking element
        (11) zrevrank acquired ranking elements, and descending order based on the score
        (12) zrem key member1 member2 remove one or more elements
        (13) zremrangebyrank key start stop position range to remove elements according to
        (14) zremrangebyscore key start stop element according to remove score range

Guess you like

Origin www.cnblogs.com/zhexuejun/p/11539623.html