当前位置:网站首页>Redis operation uses cursor instead of keys
Redis operation uses cursor instead of keys
2022-07-25 09:17:00 【Qinglin emo】
redis Use cursor instead keys
/** * scan Realization * * @param pattern expression , Such as :abc*, Find out everything to abc The start key */
public Set<String> scan(String pattern) {
return this.redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
Set<String> keysTmp = new HashSet<>();
try (Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder()
.match(pattern)
.count(10000).build())) {
while (cursor.hasNext()) {
keysTmp.add(new String(cursor.next(), "Utf-8"));
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e);
}
return keysTmp;
});
}
边栏推荐
- 富文本样式文字图片处理
- Solve NPM error: cannot find module 'shelljs‘
- [deep learning] mask Dino Trilogy - the correct way to open Detr Pandora's box
- 为什么说DAO是未来的公司形式
- Live broadcast preview | how to build an enterprise cloud management platform in the cloudy era?
- flink sql怎么持久化?
- Yolov5 environment configuration
- [learn rust together] a preliminary understanding of rust package management tool cargo
- [NPM] the "NPM" item cannot be recognized as the name of cmdlets, functions, script files or runnable programs. Please check the spelling of the name. If the path is included, make sure the path is co
- 附加:下半部分sql语句 区/县(数据表)
猜你喜欢

activemq--延迟投递和定时投递

整理 华为AP-3010DN_V2配置创建wifi
![[machine learning] Finally, the important steps of machine learning modeling have been clarified](/img/75/07767ed694502f0c910d35e1447499.jpg)
[machine learning] Finally, the important steps of machine learning modeling have been clarified

Labview--- signal generator

JS small game source code magic tower breakthrough Download

为什么说DAO是未来的公司形式

Redis/Mysql知识概述

This ten-year content industry infrastructure company is actually an invisible Web3 pioneer

activemq--可持久化机制之JDBC的journal
[learn rust together] a preliminary understanding of rust package management tool cargo
随机推荐
[arm] Xintang nuc977 transplants wk2124 drive
SQL injection
28.插槽
Shell脚本
黑马程序员JDBC
Silicon Valley classroom lesson 15 - Tencent cloud deployment
Arcgis10.2 installation tutorial
OmniPeek packet capturing tool
[BUUCTF-n1book][第二章 web进阶]SSRF Training
51 MCU internal peripherals: serial port communication
附加:在在下部分区/县(数据表)
uniapp中scroll-view的坑
How does Youxuan database encrypt data?
Learning Weekly - total issue 63 - an open source local code snippet management tool
酷炫canvas动画冲击波js特效
【sklearn】sklearn.preprocessing.LabelEncoder
This is the worst controller layer code I've ever seen
[hero planet July training leetcode problem solving daily] 19th binary tree
28. Slot
Leetcode-238. product of arrays other than itself