Skip to content

Commit 6547eb4

Browse files
committed
refactor(ecache): rename sub package name from 'memory' to 'miniredis'.
1 parent 71cdb7f commit 6547eb4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

ecache/entity_cache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ var (
1818
Marshal func(v any) ([]byte, error) = json.Marshal
1919
// Unmarshal 默认反序列化方案
2020
Unmarshal func(data []byte, v any) error = json.Unmarshal
21-
// Expiration 缓存默认过期时间
22-
Expiration time.Duration
21+
// DefaultExpiration 缓存默认过期时间
22+
DefaultExpiration time.Duration = time.Hour * 24
2323
// Disabled 缓存开关
2424
Disabled bool
2525
// 缓存键名分隔符
@@ -99,7 +99,7 @@ func GetEntityByID[T CacheableEntity[INT], INT constraints.Integer](
9999
if data, err = Marshal(entity); err != nil {
100100
return nil, errors.WithStack(err)
101101
}
102-
if err = cache.Set(ctx, key, data, Expiration); err != nil {
102+
if err = cache.Set(ctx, key, data, DefaultExpiration); err != nil {
103103
return nil, errors.WithStack(err)
104104
}
105105

@@ -159,7 +159,7 @@ func GetEntitiesByID[T CacheableEntity[INT], INT constraints.Integer](
159159
if data, err = Marshal(&items); err != nil {
160160
return nil, errors.WithStack(err)
161161
}
162-
if err = cache.Set(ctx, key, data, Expiration); err != nil {
162+
if err = cache.Set(ctx, key, data, DefaultExpiration); err != nil {
163163
return nil, errors.WithStack(err)
164164
}
165165

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package memory
1+
package miniredis
22

33
import (
44
"context"

0 commit comments

Comments
 (0)