Skip to content

Commit 842d55d

Browse files
authored
fix(multiple): march 2025 wave (#604)
* fix(#594): purge a specific key if the key name include a question mark * fix(#590): caddy startup without global directive fallback on default ttl * tmp(caddy): downgrade to v1.7.5 * revert(bump): rollback to v1.7.6
1 parent 98a06f0 commit 842d55d

File tree

6 files changed

+17
-27
lines changed

6 files changed

+17
-27
lines changed

pkg/storage/defaultProvider.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ func (provider *Default) DeleteMany(key string) {
181181
re, e := regexp.Compile(key)
182182

183183
if e != nil {
184-
return
184+
provider.logger.Infof("Failed to compile key %s, %v", key, e)
185185
}
186186

187-
provider.m.Range(func(key, _ any) bool {
188-
if re.MatchString(key.(string)) {
187+
provider.m.Range(func(current, _ any) bool {
188+
if (re != nil && re.MatchString(current.(string))) || strings.HasPrefix(current.(string), key) {
189189
provider.m.Delete(key)
190190
}
191191

plugins/caddy/httpcache.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
137137
}
138138

139139
if app.DefaultCache.GetTTL() == 0 {
140-
return nil
140+
if s.Configuration.DefaultCache.GetTTL() == 0 {
141+
app.DefaultCache.TTL = configurationtypes.Duration{Duration: 120 * time.Second}
142+
}
141143
}
142144

143145
s.Configuration.API = app.API

plugins/go-zero/examples/internal/handler/routes.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/traefik/override/storage/cacheProvider.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,11 @@ func (provider *Cache) Delete(key string) {
155155

156156
// DeleteMany method will delete the responses in Cache provider if exists corresponding to the regex key param
157157
func (provider *Cache) DeleteMany(key string) {
158-
re, e := regexp.Compile(key)
158+
re, _ := regexp.Compile(key)
159159

160-
if e != nil {
161-
return
162-
}
163-
164-
provider.Cache.Range(func(k, _ interface{}) bool {
165-
if re.MatchString(k.(string)) {
166-
provider.Delete(k.(string))
160+
provider.Cache.Range(func(current, _ any) bool {
161+
if (re != nil && re.MatchString(current.(string))) || strings.HasPrefix(current.(string), key) {
162+
provider.Delete(current.(string))
167163
}
168164
return true
169165
})

plugins/traefik/vendor/github.com/darkweak/souin/pkg/storage/cacheProvider.go

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/tyk/override/storage/cacheProvider.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,10 @@ func (provider *Cache) Delete(key string) {
9999

100100
// DeleteMany method will delete the responses in Cache provider if exists corresponding to the regex key param
101101
func (provider *Cache) DeleteMany(key string) {
102-
re, e := regexp.Compile(key)
103-
104-
if e != nil {
105-
return
106-
}
102+
re, _ := regexp.Compile(key)
107103

108104
for k := range provider.Items() {
109-
if re.MatchString(k) {
105+
if (re != nil && re.MatchString(k)) || strings.HasPrefix(k, key) {
110106
provider.Delete(k)
111107
}
112108
}

0 commit comments

Comments
 (0)