Skip to content

Commit

Permalink
feat(cache): update cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronnie committed Dec 7, 2024
1 parent dab3694 commit 6f1cf38
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"time"

"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/jsonx"
zerocache "github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/core/stores/redis"
Expand Down Expand Up @@ -76,10 +75,10 @@ func (c cacheNode) TakeWithExpireCtx(ctx context.Context, val any, key string, q
return c.node.TakeWithExpireCtx(ctx, val, key, query)
}

func NewRedisNode(rds *redis.Redis) Cache {
func NewRedisNode(rds *redis.Redis, errNotFound error) Cache {
singleFlights := syncx.NewSingleFlight()
stats := zerocache.NewStat("redis-cache")
node := zerocache.NewNode(rds, singleFlights, stats, errors.New("cache not found"))
node := zerocache.NewNode(rds, singleFlights, stats, errNotFound)
return &cacheNode{
node: node,
}
Expand Down

0 comments on commit 6f1cf38

Please sign in to comment.