Skip to content

Commit

Permalink
update: cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohrusky committed Jul 13, 2024
1 parent e7d89ba commit 04c18c9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/middleware/cache/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// Response 缓存接口响应的中间件
func Response(redisClient *cache.Client, ttl time.Duration, queryFilter []string) gin.HandlerFunc {
func Response(redisClient *cache.Client, ttl time.Duration, queryFilter ...string) gin.HandlerFunc {
redisStore := persist.NewRedisStore(redisClient.C)

strategy := gin_cache.WithCacheStrategyByRequest(
Expand Down
2 changes: 1 addition & 1 deletion internal/router/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewAPI() *gin.Engine {
user.GET("profile/me",
middleware_cache.JWTBlacklist(cache.Clients[cache.JWTBlacklist], false),
jwt.RequireAuth(),
middleware_cache.Response(cache.Clients[cache.RespCache], 1*time.Minute, nil),
middleware_cache.Response(cache.Clients[cache.RespCache], 1*time.Minute),
user_service.ProfileMe,
)
}
Expand Down
2 changes: 1 addition & 1 deletion module/util/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestRemoveQueryParameter(t *testing.T) {
},
{
name: "empty query",
args: args{rawurl: "https://114514.com/?token=eyJhb", keys: []string{}},
args: args{rawurl: "https://114514.com/?token=eyJhb"},
want: "https://114514.com/?token=eyJhb",
},
}
Expand Down

0 comments on commit 04c18c9

Please sign in to comment.