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
03d19da1
Commit
03d19da1
authored
Mar 31, 2022
by
wangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expireAt 方法
parent
483205e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
RedisBloomHandler.java
...duiba/spring/boot/starter/dsp/util/RedisBloomHandler.java
+10
-2
No files found.
spring-boot-starter-dsp-util/src/main/java/cn/com/duiba/spring/boot/starter/dsp/util/RedisBloomHandler.java
View file @
03d19da1
...
@@ -225,7 +225,7 @@ public class RedisBloomHandler<K, V> {
...
@@ -225,7 +225,7 @@ public class RedisBloomHandler<K, V> {
* @return
* @return
*/
*/
public
Integer
saveBloom
(
String
key
,
String
value
,
Integer
levelCount
)
{
public
Integer
saveBloom
(
String
key
,
String
value
,
Integer
levelCount
)
{
String
luaText
=
"local a = "
+(
levelCount
+
1
)+
"\n"
+
String
luaText
=
"local a = "
+
(
levelCount
+
1
)
+
"\n"
+
"for i = 1, #(ARGV)+1 do\n"
+
"for i = 1, #(ARGV)+1 do\n"
+
" if(redis.call('BF.ADD', KEYS[1], (ARGV[1] .. '_' .. i)) == 1) then\n"
+
" if(redis.call('BF.ADD', KEYS[1], (ARGV[1] .. '_' .. i)) == 1) then\n"
+
" a = i;\n"
+
" a = i;\n"
+
...
@@ -264,7 +264,7 @@ public class RedisBloomHandler<K, V> {
...
@@ -264,7 +264,7 @@ public class RedisBloomHandler<K, V> {
},
true
);
},
true
);
}
}
public
void
createFiltersWithExpireAt
(
RedisTemplate
redisTemplate
,
List
<
K
>
keys
,
double
errorRate
,
long
initCapacity
,
long
expireAt
)
{
public
void
createFiltersWithExpireAt
(
RedisTemplate
redisTemplate
,
List
<
K
>
keys
,
double
errorRate
,
long
initCapacity
,
long
expireAt
)
{
byte
[]
rawErrorRate
=
rawString
(
String
.
valueOf
(
errorRate
));
byte
[]
rawErrorRate
=
rawString
(
String
.
valueOf
(
errorRate
));
byte
[]
rawInitCapacity
=
rawString
(
String
.
valueOf
(
initCapacity
));
byte
[]
rawInitCapacity
=
rawString
(
String
.
valueOf
(
initCapacity
));
Object
execute
=
redisTemplate
.
execute
(
connection
->
{
Object
execute
=
redisTemplate
.
execute
(
connection
->
{
...
@@ -287,6 +287,10 @@ public class RedisBloomHandler<K, V> {
...
@@ -287,6 +287,10 @@ public class RedisBloomHandler<K, V> {
return
redisTemplate
.
getExpire
(
key
);
return
redisTemplate
.
getExpire
(
key
);
}
}
public
Long
getExpire
(
RedisTemplate
redisTemplate
,
String
key
)
{
return
redisTemplate
.
getExpire
(
key
);
}
/**
/**
* 设置redis过去时间
* 设置redis过去时间
*
*
...
@@ -297,4 +301,8 @@ public class RedisBloomHandler<K, V> {
...
@@ -297,4 +301,8 @@ public class RedisBloomHandler<K, V> {
public
Boolean
expireAt
(
String
key
,
Date
delta
)
{
public
Boolean
expireAt
(
String
key
,
Date
delta
)
{
return
redisTemplate
.
expireAt
(
key
,
delta
);
return
redisTemplate
.
expireAt
(
key
,
delta
);
}
}
public
Boolean
expireAt
(
RedisTemplate
redisTemplate
,
String
key
,
Date
date
)
{
return
redisTemplate
.
expireAt
(
key
,
date
);
}
}
}
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