Redis data types

Source: Internet
Author: User

A total of five data types:

1, Strings-string

127.0.0.1:6379> set name "Zhaoja" ok127.0.0.1:6379> Get Name "Zhaoja"

2, hashes-hash value

3. Lists-List
The Redis list is a simple list of strings, sorted in order of insertion. You can add elements to the head or tail of the Redis list

127.0.0.1:6379> lpush nlist zhaoja (integer) 1127.0.0.1:6379> lpush nlist zhaoja2 (integer) 2127.0.0.1:6379> Lrange nlist 0 101) "ZHAOJA2" 2) "Zhaoja"

  

4, sets-set
Redis collections are unordered collections of strings

127.0.0.1:6379> sadd nalist zhaoja1 (integer) 1127.0.0.1:6379> sadd nalist zhaoja2 (integer) 1127.0.0.1:6379> Sadd nalist zhaoja3 (integer) 1127.0.0.1:6379> smembers nalist1) "ZHAOJA3" 2) "ZHAOJA2" 3) "ZHAOJA1"

  

5. Set sort
Redis collections are sorted similar to Redis collections, strings are not duplicated

127.0.0.1:6379> zadd namlist 0 zhaoja1 (integer) 1127.0.0.1:6379> zadd namlist 0 zhaoja2 (integer) 1127.0.0.1:6379& Gt Zadd namlist 0 zhaoja3 (integer) 1127.0.0.1:6379> zadd namlist 0 zhaoja4 (integer) 1127.0.0.1:6379> zrangebyscore nam List 0 10001) "ZHAOJA1" 2) "ZHAOJA2" 3) "ZHAOJA3" 4) "ZHAOJA4"

  

Redis data types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.