Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
035f9458
Commit
035f9458
authored
Dec 30, 2021
by
zhangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:[1006372]新增redis工具方法
parent
07922b73
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
0 deletions
+94
-0
JedisClusterUtils.java
...om/pcloud/common/utils/cache/redis/JedisClusterUtils.java
+94
-0
No files found.
pcloud-common/src/main/java/com/pcloud/common/utils/cache/redis/JedisClusterUtils.java
View file @
035f9458
...
...
@@ -870,6 +870,20 @@ public class JedisClusterUtils {
}
return
null
;
}
/**
* spop
*
* @param key
* @return
*/
public
static
String
spop
(
String
key
)
{
try
{
return
jedisCluster
.
spop
(
key
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"jedis列表出栈(spop)失败:"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 列表出栈(左端)
...
...
@@ -1533,4 +1547,84 @@ public class JedisClusterUtils {
}
return
result
;
}
/**
* 查看 set 中是否存在指定元素
*
* @param key
* @param value
* @return
*/
public
static
Boolean
sismember
(
String
key
,
String
value
)
{
Boolean
result
=
null
;
try
{
result
=
jedisCluster
.
sismember
(
key
,
value
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"查看 set 中是否存在指定元素:"
+
e
.
getMessage
(),
e
);
}
return
result
;
}
/**
* 设置 bit
* @param key
* @param offset
* @param value
* @return
*/
public
static
Boolean
setbit
(
String
key
,
long
offset
,
boolean
value
)
{
Boolean
result
=
null
;
try
{
return
jedisCluster
.
setbit
(
key
,
offset
,
true
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"设置 bit 异常:"
+
e
.
getMessage
(),
e
);
}
return
result
;
}
/**
* 读取bit
* @param key
* @param offset
* @return
*/
public
static
Boolean
getbit
(
String
key
,
long
offset
)
{
Boolean
result
=
null
;
try
{
return
jedisCluster
.
getbit
(
key
,
offset
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"读取 bit 异常:"
+
e
.
getMessage
(),
e
);
}
return
result
;
}
/**
* 统计bit 为1的数量
* @param key
* @return
*/
public
static
Long
bitcount
(
String
key
)
{
Long
result
=
null
;
try
{
return
jedisCluster
.
bitcount
(
key
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"计数 bit 异常:"
+
e
.
getMessage
(),
e
);
}
return
result
;
}
/**
* 统计bit 为1的数量
* @param key
* @param start 起始byte数,0开始
* @param end 结束byte数
* @return
*/
public
static
Long
bitcount
(
String
key
,
long
start
,
long
end
)
{
Long
result
=
null
;
try
{
return
jedisCluster
.
bitcount
(
key
,
start
,
end
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"计数 bit 异常:"
+
e
.
getMessage
(),
e
);
}
return
result
;
}
}
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