Skip to content

Commit

Permalink
add delete func in thread safe store
Browse files Browse the repository at this point in the history
Signed-off-by: MUzairS15 <[email protected]>
  • Loading branch information
MUzairS15 committed May 11, 2024
1 parent 3da3150 commit 6747a5c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 6747a5c

Please sign in to comment.