Skip to content

Commit

Permalink
fix(chore): allow to delete keys by regex (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSaveliev1 authored Oct 14, 2024
1 parent d9ddd13 commit 99bdcca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/api/souin.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,13 @@ 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 99bdcca

Please sign in to comment.