Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GnssServer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
zhushanglei
GnssServer
Commits
167ed878
Commit
167ed878
authored
Aug 19, 2022
by
zhushanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gps数据采集修改redis
parent
5a999eeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
RedisUtils.java
src/main/java/client/RedisUtils.java
+33
-0
No files found.
src/main/java/client/RedisUtils.java
0 → 100644
View file @
167ed878
package
client
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.params.SetParams
;
public
class
RedisUtils
{
/**
* 普通缓存放入并设置时间
*
* @param key 键
* @param value 值
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
* @return true成功 false 失败
*/
public
static
boolean
set
(
String
key
,
String
value
,
long
time
)
{
Jedis
jedis
=
null
;
try
{
if
(
time
>
0
)
{
jedis
=
JedisConnectFactory
.
getJedis
();
SetParams
params
=
new
SetParams
();
params
.
ex
(
time
);
jedis
.
set
(
key
,
value
,
params
);
}
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
finally
{
jedis
.
close
();
}
}
}
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