Redis 5 types of data and additions and deletions

Source: Internet
Author: User

1 #  Strings string  2 (1) Add data 3setkey  value  # Add a 4key[key value ... ] ]  # Add multiple 5 append  key  value  # to end

6(2) Delete Data7DelKey# Delete key8 flushdb #删除当前数据库所有key9 Flushall # Delete allTen  One(3) Modify the data ARenameKeyNewkey #改名 - Set KeyValue # Direct Replacement -(4) View Data theGetKey#查看一条 -MgetKey [Key ...]# View more than one -Keys*# View All keys

1 #列表list 2 (1) Add data 3key[value ... ]  # Head Insert
4 Key [value ... ]  # Trailing insert 5 (2) Delete data 6key  # Delete left first 7 rpop  key  # Delete right first 8keycount  Value # Deletes a specified number of values

  9  (3   10  lset key  Span style= "COLOR: #0000ff" >index   newvalue # Specify index number modification  11  (4  ) View data  12  lindex key  index   # Returns the specified index value  13  lrange Span style= "COLOR: #0000ff" >key   start stop # view values in the index range  14  llen key  # View Length 
1 # hashed Hash 2 (1) Add data 3key  field value  # Add a 4key [field value ... ]  5

6(2) Delete Data7HdelKeyField8(3) Modify the data9 " "cover" "Ten(4) View Data OneHgetKeyField # Get value AHmgetKeyField[field ...]# Get multiple value -HvalsKey# get all value -HkeysKey# get all field theHgetallKey# Get all field and value -HlenKey# See a few key-value pairs
1# CollectionSet2(1) Increase3SaddKeyMember[member ...]#增加元素4(2) by deleting5SremKeyMember[member ...]#移除元素6SpopKey# Random Deletion7(3) Change8(4) Check9SCardKey# Returns the number of elements in keyTenSmemebersKey# gets all the elements in the collection

 One (5) intersection sinter my_set1 my_set2 # intersectionsinterstore newset My_set1 My_set2 # intersection Merge to new collection  (6) and set upsunion key1 Key2  # sunionstore newkey key1 key2 # Union merge to new collection

 (7) difference set ofSdiff key1 key2  # difference set sdiffstore newkey key1 key2  # difference set Merge to new collection
1 # ordered set Zset2(1) Increase3ZaddKeyScore member[[Score member] ..]4(2) by deleting5ZremKeyMember[member ...]#移除有序集合中的一个或多个元素, if the member does not exist then ignore;6Zremrangebyrankmin Max :7 # Remove elements from a collection in a given interval score8(3) Change9(4) CheckTenZscoreKeymember # viewing score values OneZrangeKeyStart stop[Withscores]#按索引返回key的成员, Withscores indicates the display score AZrangebyscoreKey min Max#返回集合中 score elements in a given interval

Redis 5 types of data and additions and deletions

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.