使用redis的zset进行原子增及统计
使用redis的zset进行原子增及统计
maven
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency>
incr
redisTemplate.boundZSetOps("myzset").incrementScore(key,1L);
sort
int start = (page - 1) * PAGE_SIZE; int end = start + PAGE_SIZE - 1; Set<ZSetOperations.TypedTuple<String>> reportCodes = redisTemplate .boundZSetOps("myzset") .reverseRangeWithScores(start,end);
doc
[ZRANGE key start stop [WITHSCORES]](https://redis.io/commands/zra...
相关推荐
AlexZhao 2020-06-04
gongruitao 2019-12-27
ciscoccie00 2019-12-19
lvxingzhe 2019-11-04
xienue 2019-10-29
wsxsxz 2019-10-21
书山有路勤为径 2019-07-01
guchengxinfen 2017-06-07
Jhonse技术 2011-01-07
山水沐光 2019-05-09
Broadview 2010-02-19
Franklyn 2011-12-03
朝气蓬勃 2019-06-12
sgafdsg 2011-04-18
hello小工 2017-10-09
VacantYang 2018-04-05
89284052 2016-10-15
wxysummer 2016-10-24