Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
098c1e88
authored
Jun 05, 2025
by
RedwindA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: rename RedisHDelObj to RedisDelKey and update references
parent
15607996
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
common/redis.go
+2
-2
model/token_cache.go
+1
-1
model/user_cache.go
+3
-2
No files found.
common/redis.go
View file @
098c1e88
...
@@ -92,9 +92,9 @@ func RedisDel(key string) error {
...
@@ -92,9 +92,9 @@ func RedisDel(key string) error {
return
RDB
.
Del
(
ctx
,
key
)
.
Err
()
return
RDB
.
Del
(
ctx
,
key
)
.
Err
()
}
}
func
Redis
HDelObj
(
key
string
)
error
{
func
Redis
DelKey
(
key
string
)
error
{
if
DebugEnabled
{
if
DebugEnabled
{
SysLog
(
fmt
.
Sprintf
(
"Redis
HDEL
: key=%s"
,
key
))
SysLog
(
fmt
.
Sprintf
(
"Redis
DEL Key
: key=%s"
,
key
))
}
}
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
return
RDB
.
Del
(
ctx
,
key
)
.
Err
()
return
RDB
.
Del
(
ctx
,
key
)
.
Err
()
...
...
model/token_cache.go
View file @
098c1e88
...
@@ -19,7 +19,7 @@ func cacheSetToken(token Token) error {
...
@@ -19,7 +19,7 @@ func cacheSetToken(token Token) error {
func
cacheDeleteToken
(
key
string
)
error
{
func
cacheDeleteToken
(
key
string
)
error
{
key
=
common
.
GenerateHMAC
(
key
)
key
=
common
.
GenerateHMAC
(
key
)
err
:=
common
.
Redis
HDelObj
(
fmt
.
Sprintf
(
"token:%s"
,
key
))
err
:=
common
.
Redis
DelKey
(
fmt
.
Sprintf
(
"token:%s"
,
key
))
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
model/user_cache.go
View file @
098c1e88
...
@@ -3,11 +3,12 @@ package model
...
@@ -3,11 +3,12 @@ package model
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"github.com/gin-gonic/gin"
"one-api/common"
"one-api/common"
"one-api/constant"
"one-api/constant"
"time"
"time"
"github.com/gin-gonic/gin"
"github.com/bytedance/gopkg/util/gopool"
"github.com/bytedance/gopkg/util/gopool"
)
)
...
@@ -57,7 +58,7 @@ func invalidateUserCache(userId int) error {
...
@@ -57,7 +58,7 @@ func invalidateUserCache(userId int) error {
if
!
common
.
RedisEnabled
{
if
!
common
.
RedisEnabled
{
return
nil
return
nil
}
}
return
common
.
Redis
HDelObj
(
getUserCacheKey
(
userId
))
return
common
.
Redis
DelKey
(
getUserCacheKey
(
userId
))
}
}
// updateUserCache updates all user cache fields using hash
// updateUserCache updates all user cache fields using hash
...
...
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