Skip to content

Commit

Permalink
fix(chore): allow to delete keys by regex (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
HobMartin authored Jun 23, 2024
1 parent c478a2b commit dd172cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/api/souin.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,15 @@ func (s *SouinAPI) BulkDelete(key string, purge bool) {
}

// Delete will delete a record into the provider cache system and will update the Souin API if enabled
// The key can be a regexp to delete multiple items
func (s *SouinAPI) Delete(key string) {
_, err := regexp.Compile(key)
for _, current := range s.storers {
current.Delete(key)
if err != nil {
current.DeleteMany(key)
} else {
current.Delete(key)
}
}
}

Expand Down

0 comments on commit dd172cb

Please sign in to comment.