Skip to content

Commit

Permalink
fix(chore): allow to delete keys by regex
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSaveliev1 committed Oct 11, 2024
1 parent d9ddd13 commit 48b8b7f
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 48b8b7f

Please sign in to comment.