Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
spring-boot-starter-dsp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
shenjiaqing
spring-boot-starter-dsp
Commits
b1bd01f0
Commit
b1bd01f0
authored
Jun 09, 2022
by
lizhiheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新增一个方法,lua自助
parent
8ed6a959
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
build.gradle
build.gradle
+1
-1
RedisBloomHandler.java
...duiba/spring/boot/starter/dsp/util/RedisBloomHandler.java
+21
-2
No files found.
build.gradle
View file @
b1bd01f0
...
@@ -38,7 +38,7 @@ allprojects {
...
@@ -38,7 +38,7 @@ allprojects {
}
}
group
=
"cn.com.duiba.boot"
group
=
"cn.com.duiba.boot"
version
=
"0.0.5
0
"
version
=
"0.0.5
1
"
}
}
subprojects
{
subprojects
{
...
...
spring-boot-starter-dsp-util/src/main/java/cn/com/duiba/spring/boot/starter/dsp/util/RedisBloomHandler.java
View file @
b1bd01f0
...
@@ -247,8 +247,9 @@ public class RedisBloomHandler<K, V> {
...
@@ -247,8 +247,9 @@ public class RedisBloomHandler<K, V> {
* 添加到bloom
* 添加到bloom
* 添加该方法是为了兼容lettuce客户端,lettuce会进行命令校验
* 添加该方法是为了兼容lettuce客户端,lettuce会进行命令校验
* 其枚举值类:{CommandType}中没有BF.ADD或者BF.MEXISTS等方法,只能通过直接写在lua中,绕过命令校验
* 其枚举值类:{CommandType}中没有BF.ADD或者BF.MEXISTS等方法,只能通过直接写在lua中,绕过命令校验
* @param key redis key
*
* @param value 值
* @param key redis key
* @param value 值
* @return
* @return
*/
*/
public
Integer
luaAdd
(
String
key
,
String
value
)
{
public
Integer
luaAdd
(
String
key
,
String
value
)
{
...
@@ -263,6 +264,24 @@ public class RedisBloomHandler<K, V> {
...
@@ -263,6 +264,24 @@ public class RedisBloomHandler<K, V> {
return
null
;
return
null
;
}
}
/**
* 自助接口,传入需要使用到的redis实例、lua表达式、key和value
* 需要注意的是,这个方法返回类型是数字整形
* @param redisTemplate 使用到到redis实例
* @param luaText 传入到lua脚本
* @param key
* @param value
* @return
*/
public
Object
execute
(
RedisTemplate
redisTemplate
,
String
luaText
,
String
key
,
String
value
)
{
DefaultRedisScript
<
Long
>
redisScript
=
new
DefaultRedisScript
<>();
redisScript
.
setScriptSource
(
new
StaticScriptSource
(
luaText
));
redisScript
.
setResultType
(
Long
.
class
);
Object
execute
=
redisTemplate
.
execute
(
redisScript
,
Collections
.
singletonList
(
key
),
value
);
return
execute
;
}
/**
/**
* 判断创建redis 布隆过滤器
* 判断创建redis 布隆过滤器
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment