Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rym-util
Project
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
zhengqiuyun
rym-util
Commits
e3aad5f8
Commit
e3aad5f8
authored
Aug 15, 2022
by
zhengqiuyun86
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化
parent
e02d2e5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
RedisClient.go
redis/RedisClient.go
+9
-3
RedisClient_test.go
redis/RedisClient_test.go
+19
-0
No files found.
redis/RedisClient.go
View file @
e3aad5f8
...
@@ -80,7 +80,13 @@ func Set(k string, v string) {
...
@@ -80,7 +80,13 @@ func Set(k string, v string) {
log
.
Debug
(
fmt
.
Sprintf
(
"设置缓存成功:%s %s"
,
k
,
v
))
log
.
Debug
(
fmt
.
Sprintf
(
"设置缓存成功:%s %s"
,
k
,
v
))
}
}
func
Expire
(
k
string
,
t
int64
)
{
func
Expire
(
k
string
,
t
int64
)
bool
{
getDb
()
.
Expire
(
k
,
time
.
Duration
(
t
))
b
:=
getDb
()
.
Expire
(
k
,
time
.
Duration
(
t
*
1000000000
))
log
.
Debug
(
fmt
.
Sprintf
(
"设置缓存过期成功:%s %d"
,
k
,
t
))
if
b
.
Val
()
{
log
.
Debug
(
fmt
.
Sprintf
(
"设置缓存过期成功:%s %d"
,
k
,
t
))
}
else
{
log
.
Debug
(
fmt
.
Sprintf
(
"设置缓存过期失败:%s %d"
,
k
,
t
))
}
return
b
.
Val
()
}
}
redis/RedisClient_test.go
0 → 100644
View file @
e3aad5f8
package
redis
import
(
"git.168cad.top/zhengqiuyun/rym-util/conf"
"testing"
)
func
init
()
{
conf
.
Redis
=
conf
.
RedisConf
{
RedisHost
:
"to-chengdu-office.168cad.top"
,
RedisPort
:
50001
,
RedisPwd
:
"testPassevnsoo567"
,
RedisDb
:
0
,
}
}
func
TestExpire
(
t
*
testing
.
T
)
{
Init
()
Expire
(
"ZQY123"
,
1000
)
}
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