redis type

redis data type is very important

There are interviews often test string, list, hash

Five types of data commonly redis

  1. string (string)

    1.1 redis String is the most basic type, you will be appreciated that exactly the same as the type of Memcached, a key corresponding to a value.
    1.2 string type is binary safe. Redis meaning of string can contain any data. Such as a JPG image or a sequence of objects (serialization Python, json, pickle, cPickle).
    1.3 string data type is redis basic type, a redis string value can be up to 512M.

  2. hash (hash, similar to java where the Map)

    2.1 Redis hash is a collection of key-value pairs.
    2.2 redis hash field is a string type and the value of the mapping table, hash particularly suitable for storing objects.
    Similar java 2.3 Lane map <string, object>
     
  3. list (list)

    Redis list is a simple list of strings, sort insertion order. You can add an element to the head of the list (on the left) or tails (to the right).
    The bottom floor is actually a linked list
     
  4. set (collection)

    Redis of type string set unordered set without duplication. It is achieved through hashtable.
     
  5. zset (sorted set: an ordered collection)

    Redis zset and is set as a collection of string type elements, and does not allow duplicate members.

    The difference is that a double score will be associated with each type of element.

    It is to redis from small to large order of collection of member passing score. zset member is unique, but the score (score) it can be repeated.

    Such as playing cards, how many people will show reached 100,000, 100 points playing ... How many people will use this general type

Guess you like

Origin blog.csdn.net/m0_37264741/article/details/93380696