Skip to content

Commit

Permalink
Merge pull request #497 from MUzairS15/MUzairS15/pattern
Browse files Browse the repository at this point in the history
add delete func in thread safe store
  • Loading branch information
Mohd Uzair authored May 11, 2024
2 parents 3da3150 + 6747a5c commit bd00372
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 bd00372

Please sign in to comment.