fix var memory cache bug
This commit is contained in:
parent
f257a966e6
commit
57d345e445
3
cache/vars.go
vendored
3
cache/vars.go
vendored
|
@ -156,7 +156,10 @@ type VarMemoryCache[T any] struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *VarMemoryCache[T]) ClearExpired(ctx context.Context) {
|
func (c *VarMemoryCache[T]) ClearExpired(ctx context.Context) {
|
||||||
|
_, ok := c.Get(ctx)
|
||||||
|
if !ok {
|
||||||
c.Flush(ctx)
|
c.Flush(ctx)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewVarMemoryCache[T any](expireTime func() time.Duration) *VarMemoryCache[T] {
|
func NewVarMemoryCache[T any](expireTime func() time.Duration) *VarMemoryCache[T] {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user