当前位置:网站首页>Redis General Command

Redis General Command

2022-06-12 15:43:00 ZgaoYi

1.String type

String Three types of formats

  • character string : Normal string
  • int type : Integer types , Can do self increasing , Since the reduction of operating
  • float type : Floating point type , You can do auto increase and auto decrease
  • Redis Of key Format :[ Project name ]:[ Business name ]:[ type ]:[id]
     Insert picture description here

2.Hash type

Hash type , Also called hash , Its value It's an unordered Dictionary , Be similar to Java Medium HashMap structure .
 Insert picture description here  Insert picture description here practice :
 Insert picture description here

3.List type

Redis Medium List The type and Java Medium LinkedList similar , It can be regarded as a two-way linked list structure . It can support both forward and reverse retrieval .
Same characteristics LinkedList

  • Orderly
  • Elements can be repeated
  • Insert and delete fast
  • The query speed is average
     Insert picture description here practice :
     Insert picture description here

4.Set type

Redis Of Set Structure and Java Medium HashSet be similar , Can be seen as a value by null Of HashMap. Because it is also a Hash surface , So it also has HashSet Similar features :

  • disorder
  • Element is not repeatable
  • Quick search
  • Support intersection 、 Combine 、 Difference set and other functions

 Insert picture description here practice :
 Insert picture description here

5.SortSet type

Redis Of SortSet It's a sortable set aggregate , And Java Medium treeSet Some similar , But the underlying data structure is very different .SortSet Each element in the has a score attribute , Can be based on score Attribute to sort elements , The bottom implementation is a jump table plus hash surface
SortedSet It has the following characteristics :

  • Sortable
  • Element is not repeatable
  • Fast query speed
    because SortedSet SORTABILITY of , Often used to implement functions like leaderboards

 Insert picture description here

原网站

版权声明
本文为[ZgaoYi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121528337947.html