当前位置:网站首页>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;
});
}
边栏推荐
- 28. Slot
- [C language] dynamic memory management, flexible array
- Anti shake and throttling
- c语言中的六个存储类型:auto register static extern const volatile
- [graduation project] cinema booking management system based on micro Service Framework
- js小游戏源码魔塔闯关下载
- activemq--可持久化机制之AMQ
- 图解LeetCode——919. 完全二叉树插入器(难度:中等)
- Arrange the array into the smallest number
- OmniPeek packet capturing tool
猜你喜欢

(self drawn ugly picture) simple understanding tcp/ip three handshakes and four waves

Troubleshooting error: NPM install emojis list failed

Silicon Valley classroom lesson 12 - official account on demand course and live broadcast management module

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

uni-app - Refused to display ‘xxx‘ in a frame because an ancestor violates the following Content Sec

activemq--死信队列

Canvas dynamic picture avatar shaking JS special effect

centos更改mysql数据库目录

Why use MQ message oriented middleware? These questions must be taken down!

51 MCU peripherals: Motor
随机推荐
Comments on specific applications of camera
Asp. Net core CMD common instructions
Do you know these methods of MySQL database optimization?
Wechat applet obtains the data of ---- onenet and controls the on-board LED of STM32
sticksy.js页面滚动div固定位置插件
activemq--可持久化机制之JDBC的journal
Six storage types in C language: Auto register static extern const volatile
Sticky.js page scrolling div fixed position plug-in
activemq--可持久化机制
附加:在在下部分区/县(数据表)
附加:中半部分sql语句 区/县(数据表)
Druid 查询超时配置的探究 → DataSource 和 JdbcTemplate 的 queryTimeout 到底谁生效?
activemq--持久化机制之LevelDB
Uniapp intercepts route jumps through addinterceptor to control whether the page needs to log in
The hole of scroll view in uniapp
JDBC快速入门
API parsing of JDBC
How to write the code of wechat applet implementation tab
Ten thousand words long, one word thoroughly! Finally, someone has made business intelligence (BI) clear
Visual query (sp_helptext) -- quick query of stored procedures containing specified strings (with source code)