diff --git a/app/cmd/cachemanager/flush_test.go b/app/cmd/cachemanager/flush_test.go index 34e89be..d574437 100644 --- a/app/cmd/cachemanager/flush_test.go +++ b/app/cmd/cachemanager/flush_test.go @@ -53,3 +53,19 @@ func TestFlushMapVal(t *testing.T) { fmt.Println(vv.Get(ctx, 6)) }) } + +func TestSetExpireTime(t *testing.T) { + t.Run("t1", func(t *testing.T) { + c := NewMemoryMapCache[string, string](nil, nil, time.Second, "xx") + c.Set(ctx, "xx", "yy") + fmt.Println(c.Get(ctx, "xx")) + time.Sleep(time.Second) + fmt.Println(c.Get(ctx, "xx")) + SetExpireTime(3*time.Second, "xx") + c.Set(ctx, "xx", "yyy") + time.Sleep(time.Second) + fmt.Println(c.Get(ctx, "xx")) + time.Sleep(3 * time.Second) + fmt.Println(c.Get(ctx, "xx")) + }) +} diff --git a/app/cmd/reload/reload.go b/app/cmd/reload/reload.go index a610095..e71bd48 100644 --- a/app/cmd/reload/reload.go +++ b/app/cmd/reload/reload.go @@ -261,7 +261,7 @@ func Push(fn func(), a ...any) { func Reload() { anyMap.Flush() - safetyMaps.Flush() + //safetyMaps.Flush() callsM.Flush() flushMapFn.Flush() callll := calls.Load()