Skip to content

Commit

Permalink
Merge pull request #185 from retail-ai-inc/fix/change-to-non-bulk-del…
Browse files Browse the repository at this point in the history
…etion

Fix Bulk deletion to Non-Bulk, with wildcard
  • Loading branch information
tanvir-retailai committed Mar 29, 2024
2 parents 20c9e82 + d6ecd21 commit 7f2a693
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions store/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,12 @@ func (mem *memoryCache) DelMemory(key string) {
}

// Delete by wildcard key.
var keys []string
mem.keys.ForEach(func(k string, _ data) bool {
if matchWildCard([]rune(k), []rune(key)) {
keys = append(keys, k)
mem.keys.Del(k)
}
return true
})
if len(keys) > 0 {
mem.keys.Del(keys...)
}
}

func matchWildCard(str, pattern []rune) bool {
Expand Down

0 comments on commit 7f2a693

Please sign in to comment.