From 6747a5cb1eac0e371534adbc4b9d66e38629d850 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 10 May 2024 16:13:55 +0530 Subject: [PATCH] add delete func in thread safe store Signed-off-by: MUzairS15 --- utils/store/store.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/store/store.go b/utils/store/store.go index 2c78ba55..6ce54628 100644 --- a/utils/store/store.go +++ b/utils/store/store.go @@ -28,6 +28,13 @@ func (s *GenerticThreadSafeStore[K]) Get(key string) (K, bool) { return value, ok } +func (s *GenerticThreadSafeStore[K]) Delete(key string) { + s.mx.Lock() + defer s.mx.Unlock() + delete(s.data, key) +} + + func (s *GenerticThreadSafeStore[K]) GetAllPairs() map[string]K { values := make(map[string]K, 0)