RedisTemplate API

ZSetOperations:

有序集合,默認按照score升序排列,存儲格式K(1)==V(n),V(1)=S(1)(K=key,V=value,S=score)

1.add(K,V,S):添加

2.count(K,Smin,Smax):鍵爲K的集合,Smin<=score<=Smax的元素個數

3.size(K):鍵爲K的集合元素個數

4.score(K,obj):鍵爲K的集合,value爲obj的元素分數

5.incrementScore(K,V,delta):元素分數增加,delta是增量

6.intersectAndStore(K,otherK[s],destK):K集合與otherK[s]集合,共同的交集元素存到destK(複製),返回元素個數

  unionAndStore(K,otherK[s],destK):K集合與otherK[s]集合,共同的並集元素存到destK(複製),返回元素個數

7.range(K,start,end):鍵爲K的集合,索引start<=index<=end的元素子集,正序

  reverseRange(K,start,end):鍵爲K的集合,索引start<=index<=end的元素子集,倒序

8.rangeByScore(K,Smin,Smax,[offset],[count]):鍵爲K的集合,offerset和count是限制條件,從索引1開始找到count個元素=子集,從子集中找到Smin<=score<=Smax的元素集合,返回Set<V>,正序

  reverseRangeByScore(K,Smin,Smax,[offset],[count]):鍵爲K的集合,offerset和count是限制條件,從索引1開始找到count個元素=子集,從子集中找到Smin<=score<=Smax的元素集合,返回Set<V>,倒序

9.rangeByScoreWithScores(K,Smin,Smax,[offset],[count]):鍵爲K的集合,offerset和count是限制條件,從索引1開始找到count個元素=子集,從子集中找到Smin<=score<=Smax的元素集合,返回泛型接口(包括score和value),正序

  reverseRangeByScoreWithScores(K,Smin,Smax,[offset],[count]):鍵爲K的集合,offerset和count是限制條件,從索引1開始找到count個元素=子集,從子集中找到Smin<=score<=Smax的元素集合,返回泛型接口(包括score和value),倒序

10.rangeWithScores(K,start,end):鍵爲K的集合,索引start<=index<=end的元素子集,返回泛型接口(包括score和value),正序

  reverseRangeWithScores(K,start,end):鍵爲K的集合,索引start<=index<=end的元素子集,返回泛型接口(包括score和value),倒序

11.rank(K,obj):鍵爲K的集合,value爲obj的元素索引,正序

 reverseRank(K,obj):鍵爲K的集合,value爲obj的元素索引,倒序

12.remove(K,obj):刪除,鍵爲K的集合,value爲obj的元素

13.removeRange(K,start,end):刪除,鍵爲K的集合,索引start<=index<=end的元素子集

14.removeRangeByScore(K,Smin,Smax):刪除,鍵爲K的集合,Smin<=score<=Smax的元素,返回刪除個數



SetOperations

無序集合,add的順序不是存儲順序

1.add(K key, V value) 

2.difference(K key, otherK[s]) :差集,返回Set

3.differenceAndStore(K key, otherKey[s], K destKey) :存儲差集,返回Long

4.intersect(K key, otherKey[s]):交集,返回Set

5.intersectAndStore(K key, otherKey[s], K destKey)  :存儲交集,返回Long

6.isMember(K key, java.lang.Object o) :對象是否存在

7.members(K key) :所有元素,返回Set

8.move(K key, V value, K destKey) :轉移一個元素到另一個key(剪切)

9.pop(K key) :出隊,size減1

10.randomMember(K key) :隨即元素

11.remove(K key, java.lang.Object o) :移除元素

12.size(K key)

13.union(K key, otherKey[s]):並集

14.unionAndStore(K key, otherKey[s], K destKey): 存儲並集到destKey



發佈了10 篇原創文章 · 獲贊 12 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章