Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion memorykv/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (d *Driver) Delete(ctx context.Context, keys ...string) error {
}

for _, key := range keys {
d.heap.LoadAndDelete(key)
d.heap.Delete(key)
}

return nil
Expand Down
18 changes: 0 additions & 18 deletions memorykv/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,6 @@ func (h *hmap) Set(key string, item *Item) {
h.items[key] = item
}

func (h *hmap) LoadAndDelete(key string) (*Item, bool) {
h.mu.Lock()
defer h.mu.Unlock()

item, ok := h.items[key]
if ok {
if item.callback != nil {
select {
case item.callback.stopCh <- struct{}{}:
default:
}
}
delete(h.items, key)
}

return item, ok
}

func (h *hmap) Clean() {
h.mu.Lock()
defer h.mu.Unlock()
Expand Down
Loading