Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit dab3694

Browse files
committed
feat(cache): update cache
1 parent 9fa9841 commit dab3694

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package redis
1+
package cache
22

33
import (
44
"context"
@@ -9,8 +9,6 @@ import (
99
zerocache "github.com/zeromicro/go-zero/core/stores/cache"
1010
"github.com/zeromicro/go-zero/core/stores/redis"
1111
"github.com/zeromicro/go-zero/core/syncx"
12-
13-
"github.com/jzero-io/jzero-contrib/cache"
1412
)
1513

1614
type cacheNode struct {
@@ -78,7 +76,7 @@ func (c cacheNode) TakeWithExpireCtx(ctx context.Context, val any, key string, q
7876
return c.node.TakeWithExpireCtx(ctx, val, key, query)
7977
}
8078

81-
func NewCacheNode(rds *redis.Redis) cache.Cache {
79+
func NewRedisNode(rds *redis.Redis) Cache {
8280
singleFlights := syncx.NewSingleFlight()
8381
stats := zerocache.NewStat("redis-cache")
8482
node := zerocache.NewNode(rds, singleFlights, stats, errors.New("cache not found"))
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sync
1+
package cache
22

33
import (
44
"context"
@@ -8,8 +8,6 @@ import (
88
"time"
99

1010
"github.com/zeromicro/go-zero/core/errorx"
11-
12-
"github.com/jzero-io/jzero-contrib/cache"
1311
)
1412

1513
type (
@@ -28,8 +26,8 @@ func (sm *syncMap) SetNoExpireCtx(ctx context.Context, key string, val any) erro
2826
return sm.SetCtx(ctx, key, val)
2927
}
3028

31-
// New creates an instance of SyncMap cache driver
32-
func New(errNotFound error) cache.Cache {
29+
// NewSyncMap creates an instance of SyncMap cache driver
30+
func NewSyncMap(errNotFound error) Cache {
3331
return &syncMap{
3432
storage: &sync.Map{},
3533
errNotFound: errNotFound,

0 commit comments

Comments
 (0)