Example #1
0
 /**
  * Sort-Set数据类型 只增加key对应的分数,若key和元素不存在会先创建再增加
  *
  * @param key
  * @param objValue
  * @param score 新增分数
  * @return 最新分数
  */
 public Double incrementZSetScore(String key, Serializable objValue, Double score) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.incrementScore(key, objValue, score);
 }
 public Set<TypedTuple<V>> reverseRangeByScoreWithScores(double min, double max) {
   return ops.reverseRangeByScoreWithScores(getKey(), min, max);
 }
 public Long rank(Object o) {
   return ops.rank(getKey(), o);
 }
 public void intersectAndStore(K otherKey, K destKey) {
   ops.intersectAndStore(getKey(), otherKey, destKey);
 }
 public Set<V> range(long start, long end) {
   return ops.range(getKey(), start, end);
 }
 public void unionAndStore(Collection<K> otherKeys, K destKey) {
   ops.unionAndStore(getKey(), otherKeys, destKey);
 }
 public Double incrementScore(V value, double delta) {
   return ops.incrementScore(getKey(), value, delta);
 }
Example #8
0
 /**
  * Sort-Set数据类型 读取某元素所在value集合的索引
  *
  * @param key
  * @param obj
  * @return 返回对象所在集合的索引
  */
 public long getZSetRank(String key, Object obj) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.rank(key, obj);
 }
Example #9
0
 /**
  * Sort-Set数据类型 删除value集合中某元素
  *
  * @param key
  * @param obj 元素对象
  * @return true成功 false失败
  */
 public boolean removeZSet(String key, Object obj) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.remove(key, obj) > 0;
 }
Example #10
0
 /**
  * Sort-Set数据类型 读取minScore - maxScore 分数范围内value集合
  *
  * @param key
  * @param minScore 开始分数
  * @param maxScore 结束分数
  * @return Set数据集合
  */
 public Set getZSetRangByScore(String key, Double minScore, Double maxScore) {
   zSetOps = redisTemplate.opsForZSet();
   return (Set) zSetOps.rangeByScore(key, minScore, maxScore);
 }
Example #11
0
 /**
  * Sort-Set数据类型 读取value中存储某元素的分数
  *
  * @param key
  * @param obj set中一个对象
  * @return 返回对象所在集合的分数
  */
 public Double getZSetScore(String key, Object obj) {
   zSetOps = redisTemplate.opsForZSet();
   Double score = zSetOps.score(key, obj);
   if (score == null) return 0.0;
   else return score;
 }
Example #12
0
 /**
  * Sort-Set数据类型 读取beginIndex - endIndex 索引范围内value集合 高到底排序
  *
  * @param key
  * @param beginIndex 开始索引
  * @param endIndex 结束索引
  * @return Set数据集合
  */
 public Set getZSetRevRang(String key, long beginIndex, long endIndex) {
   zSetOps = redisTemplate.opsForZSet();
   return (Set) zSetOps.reverseRange(key, beginIndex, endIndex);
 }
Example #13
0
 /**
  * Sort-Set数据类型 读取minScore - maxScore 分数范围内的元素个数
  *
  * @param key
  * @param minScore 最小分数
  * @param maxScore 最大分数
  */
 public long getZSetCountByScore(String key, Double minScore, Double maxScore) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.count(key, minScore, maxScore);
 }
Example #14
0
 /**
  * Sort-Set数据类型 读取key值的元素个数
  *
  * @param key
  * @return 元素个数
  */
 public long getZSetCount(String key) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.size(key);
 }
 public Long size() {
   return ops.size(getKey());
 }
Example #16
0
 /**
  * Sort-Set数据类型 删除value集合中beginIndex - endIndex 范围的元素
  *
  * @param key
  * @param beginIndex 开始索引
  * @param endIndex 结束索引
  * @return 被删除的元素数量
  */
 public long removeZSetRange(String key, long beginIndex, long endIndex) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.removeRange(key, beginIndex, endIndex);
 }
 public void unionAndStore(K otherKey, K destKey) {
   ops.unionAndStore(getKey(), otherKey, destKey);
 }
Example #18
0
 /**
  * Sort-Set数据类型 删除value集合中minScore - maxScore 分数范围的元素
  *
  * @param key
  * @param minScore 起始分数
  * @param maxScore 结束分数
  * @return 被删除的元素数量
  */
 public long removeZSetRangeByScore(String key, Double minScore, Double maxScore) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.removeRangeByScore(key, minScore, maxScore);
 }
 public Boolean add(V value, double score) {
   return ops.add(getKey(), value, score);
 }
 public Double score(Object o) {
   return ops.score(getKey(), o);
 }
 public RedisOperations<K, V> getOperations() {
   return ops.getOperations();
 }
 public Boolean remove(Object o) {
   return ops.remove(getKey(), o);
 }
 public void intersectAndStore(Collection<K> otherKeys, K destKey) {
   ops.intersectAndStore(getKey(), otherKeys, destKey);
 }
 public void removeRange(long start, long end) {
   ops.removeRange(getKey(), start, end);
 }
 public Set<V> reverseRangeByScore(double min, double max) {
   return ops.reverseRangeByScore(getKey(), min, max);
 }
 public void removeRangeByScore(double min, double max) {
   ops.removeRangeByScore(getKey(), min, max);
 }
 public Set<TypedTuple<V>> reverseRangeWithScores(long start, long end) {
   return ops.reverseRangeWithScores(getKey(), start, end);
 }
 public Long count(double min, double max) {
   return ops.count(getKey(), min, max);
 }
 public Long reverseRank(Object o) {
   return ops.reverseRank(getKey(), o);
 }
Example #30
0
 /**
  * Sort-Set数据类型 key绑定的set里新增value元素
  *
  * @param key
  * @param objValue 可序列话的对象
  * @param score 得分
  * @return true插入成功 false失败(元素已经存在)
  */
 public boolean addZSet(String key, Serializable objValue, Double score) {
   zSetOps = redisTemplate.opsForZSet();
   return zSetOps.add(key, objValue, score);
 }