fix var memory cache bug
This commit is contained in:
parent
f257a966e6
commit
57d345e445
5
cache/vars.go
vendored
5
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) {
|
||||||
c.Flush(ctx)
|
_, ok := c.Get(ctx)
|
||||||
|
if !ok {
|
||||||
|
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