当前位置:网站首页>Redistemplate access Zset of deleted data
Redistemplate access Zset of deleted data
2022-06-10 06:03:00 【miraitowa. cn】
Redis-ZSet
if key If it does not exist, create and add data , Otherwise it adds up
redisTemplate.opsForZSet().incrementScore(key,value,score);Query the top five data
// Sort from large to small
Set<ZSetOperations.TypedTuple<String>> set = redisTemplate.opsForZSet().reverseRangeWithScores(RedisContantKey.TASK_TRAFFIC_TOP, 0, 4);
for (ZSetOperations.TypedTuple<String> stringTypedTuple : set) {
// value-stringTypedTuple.getValue().getName();
// score-stringTypedTuple.getScore()
}Delete the specified key-value The data of
// Pay attention to judge if it is not empty
Double score = redisTemplate.opsForZSet().score(key, value);
if (null!=score){
redisTemplate.opsForZSet().remove(key, value);
}Add a little basis map Of key Sort , here map Of key Is a time string :
① First of all, according to the redis Of key We found a map aggregate , According to map Of key Sort
② Yes map-key Sort
Map<Object, Object> entries = redisTemplate.opsForHash().entries(RedisContantKey.CHANNEL_TRAFFIC_DAILY_PREFIX + channelId);
// according to key Sort
ArrayList<String> keyList = new ArrayList(entries.keySet());
Collections.sort(keyList);
keyList.stream().map(key->{
if (String.valueOf(key).compareTo(sdf.format(startTime))>=0 && String.valueOf(key).compareTo(sdf.format(endTime))<=0){
dateList.add(String.valueOf(key));
}
return String.valueOf(key);
}).collect(Collectors.toList());边栏推荐
- ArcGIS application (XVIII) detailed explanation of display accuracy change of ArcGIS vector layer attribute table
- 解决wireshark中npcap安装失败问题
- Complex nested object pool (2) -- manage the object pool of a single instance object
- C#为应付期末涉及到大部分考点所设计的学生管理系统
- ArcGIS应用(十八)Arcgis 矢量图层属性表显示精度变化问题详解
- Analyse de la capture de paquets wireshark
- Working with MySQL databases in a project
- Api 接口优化的几个技巧
- The browser is much more beautiful when installing this plug-in. It has the same custom component function as apple mobile phone
- PyTorch 入门:训练一个深度神经网络(DNN)
猜你喜欢

Transformer-XL 模型详解

Improper use of BigDecimal caused P0 accident!

pm2 的安装与常用命令

Paper reading (54):deepfool: a simple and accurate method to four deep neural networks

What is the 8b/10b code?

树莓派4B编译内核模块

Encrypt / decrypt public / private key

Using kubekey to build kubernetes/kubesphere environment“

MySQL uses where in under the InnoDB engine to cause lock escalation

How to extract some specific text in excel?
随机推荐
Solution to the frequency limit of 2400 in the 7000p memory
JVM memory overflow exercise record
端系统是什么意思?
英语太差怎么办,快来写一个“百词斩”软件给自己背单词
Solution to permission denied in pushing code to coding
Basic usage of MySQL database
C # student management system designed to cope with most examination sites involved in the final period
These six open source protocols (GPL, LGPL, BSD, MIT, APACHE)
matlab中不同随机数的生成
Multithreaded producer and consumer model
Position coding in self attention mechanism
Raspberry pie 4B compiling kernel module
Flink 系例 之 TimeWindow
Picture literacy tutorial
The browser is much more beautiful when installing this plug-in. It has the same custom component function as apple mobile phone
火狐浏览器设置指向代理模式
WireShark抓包分析
Compilation error in multithreading
Paper reading (54):deepfool: a simple and accurate method to four deep neural networks
MKS h3615ns DC motor drive instruction manual