Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
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
首航-临时账号
api
Commits
0f7adddc
Commit
0f7adddc
authored
Sep 23, 2019
by
zt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
6753e606
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
RedisUtils.java
src/com/ejweb/core/util/RedisUtils.java
+24
-0
No files found.
src/com/ejweb/core/util/RedisUtils.java
View file @
0f7adddc
...
...
@@ -18,6 +18,30 @@ public class RedisUtils {
private
JedisPool
jedisPool
;
/**
* 通过key 对value进行加值+1操作,当value不是int类型时会返回错误,当key不存在是则value为1
* 自增不取消过期时间
*
* @param key
* @return 加值后的结果
*/
public
Long
incrNotResetExpireTime
(
String
key
,
int
indexDb
)
{
Jedis
jedis
=
null
;
Long
res
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
jedis
.
select
(
indexDb
);
Long
expireTime
=
jedis
.
pttl
(
key
);
res
=
jedis
.
incr
(
key
);
jedis
.
expireAt
(
key
,
expireTime
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
}
finally
{
returnResource
(
jedisPool
,
jedis
);
}
return
res
;
}
/**
* 删除key
*
* @param key
...
...
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