Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storers): default storer to use for surrogate #552

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ experimental:
plugins:
souin:
moduleName: github.com/darkweak/souin
version: v1.7.1
version: v1.7.2
```
After that you can declare either the whole configuration at once in the middleware block or by service. See the examples below.
```yaml
Expand Down
8 changes: 2 additions & 6 deletions pkg/surrogate/providers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (s *baseStorage) init(config configurationtypes.AbstractConfigurationInterf

s.Storage = storer
} else {
config.GetLogger().Debugf("Try to load the storer %s as surrogate backend", defaultStorerName)
storer := core.GetRegisteredStorer(defaultStorerName)
if storer == nil {
config.GetLogger().Errorf("Impossible to retrieve the storers %s for the surrogate-keys fallback to the default storage", configuration.SurrogateConfiguration.Storer)
Expand Down Expand Up @@ -210,7 +211,7 @@ func (s *baseStorage) purgeTag(tag string) []string {
}

// Store will take the lead to store the cache key for each provided Surrogate-key
func (s *baseStorage) Store(response *http.Response, cacheKey, uri string) error {
func (s *baseStorage) Store(response *http.Response, cacheKey, _ string) error {
h := response.Header

cacheKey = url.QueryEscape(cacheKey)
Expand Down Expand Up @@ -238,11 +239,6 @@ func (s *baseStorage) Store(response *http.Response, cacheKey, uri string) error
}
}

if h.Get("Content-Location") != "" {
location := h.Get("Content-Location")
s.storeTag(location, cacheKey, urlRegexp)
}

return nil
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/beego/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.22.4

require (
github.com/beego/beego/v2 v2.1.1
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
)
Expand Down Expand Up @@ -184,7 +184,7 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin => ../souin
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/caddy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.1

require (
github.com/caddyserver/caddy/v2 v2.8.4
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/storages/core v0.0.8
)

Expand Down Expand Up @@ -153,4 +153,4 @@ require (
howett.net/plist v1.0.0 // indirect
)

replace github.com/darkweak/souin v1.7.1 => ../..
replace github.com/darkweak/souin v1.7.2 => ../..
2 changes: 1 addition & 1 deletion plugins/caddy/httpcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (s *SouinCaddyMiddleware) configurationPropertyMapper() error {
}

func isProviderEmpty(c configurationtypes.CacheProvider) bool {
return c.Configuration == nil && c.Path == "" && c.URL == ""
return !c.Found
}

// FromApp to initialize configuration from App structure.
Expand Down
4 changes: 2 additions & 2 deletions plugins/chi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/chi
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/go-chi/chi/v5 v5.0.12
)
Expand Down Expand Up @@ -179,6 +179,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/dotweb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/dotweb
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/devfeel/dotweb v1.7.21
)
Expand Down Expand Up @@ -180,6 +180,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/echo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/echo
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/darkweak/storages/core v0.0.8
github.com/labstack/echo/v4 v4.11.1
Expand Down Expand Up @@ -182,6 +182,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/fiber/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/fiber
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/gofiber/fiber/v2 v2.52.1
github.com/valyala/fasthttp v1.51.0
Expand Down Expand Up @@ -185,6 +185,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/gin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/gin
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/gin-gonic/gin v1.9.1
)
Expand Down Expand Up @@ -196,6 +196,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/go-zero/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/go-zero
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/zeromicro/go-zero v1.6.2
)
Expand Down Expand Up @@ -199,6 +199,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/goa/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/goa
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/darkweak/storages/core v0.0.8
goa.design/goa/v3 v3.12.3
Expand Down Expand Up @@ -181,6 +181,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/goyave/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/goyave
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
goyave.dev/goyave/v4 v4.4.11
)
Expand Down Expand Up @@ -186,6 +186,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/hertz/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/hertz
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
)

Expand Down Expand Up @@ -195,6 +195,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/kratos/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/kratos
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/go-kratos/kratos/v2 v2.7.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -183,6 +183,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/roadrunner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/roadrunner
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/roadrunner-server/errors v1.3.0
Expand Down Expand Up @@ -180,7 +180,7 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin => ../souin
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/skipper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/skipper
go 1.22.1

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/zalando/skipper v0.16.145
)
Expand Down Expand Up @@ -219,6 +219,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/souin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module github.com/darkweak/souin/plugins/souin
go 1.22.1

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ./storages
)

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/darkweak/storages/core v0.0.8
github.com/fsnotify/fsnotify v1.7.0
Expand Down
2 changes: 1 addition & 1 deletion plugins/souin/storages/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.1
replace github.com/darkweak/souin => ../../..

require (
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/storages/badger v0.0.8
github.com/darkweak/storages/core v0.0.8
github.com/darkweak/storages/etcd v0.0.8
Expand Down
4 changes: 2 additions & 2 deletions plugins/traefik/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.1

require (
github.com/akyoto/cache v1.0.6
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/pquerna/cachecontrol v0.2.0
)

Expand Down Expand Up @@ -125,6 +125,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
go.uber.org/zap v1.26.0 => go.uber.org/zap v1.21.0
)
2 changes: 1 addition & 1 deletion plugins/traefik/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ github.com/cpuguy83/go-md2man/v2/md2man
# github.com/darkweak/go-esi v0.0.5
## explicit; go 1.18
github.com/darkweak/go-esi/esi
# github.com/darkweak/souin v1.7.1 => ../..
# github.com/darkweak/souin v1.7.2 => ../..
## explicit; go 1.22.1
github.com/darkweak/souin/configurationtypes
github.com/darkweak/souin/context
Expand Down
4 changes: 2 additions & 2 deletions plugins/tyk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.1
require (
github.com/TykTechnologies/tyk v1.9.2-0.20230330071232-370295d796b5
github.com/cespare/xxhash/v2 v2.2.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pquerna/cachecontrol v0.2.0
Expand Down Expand Up @@ -182,7 +182,7 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin => ../souin
gopkg.in/alecthomas/kingpin.v2 v2.2.6 => github.com/alecthomas/kingpin/v2 v2.3.2
)
4 changes: 2 additions & 2 deletions plugins/webgo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.1

require (
github.com/bnkamalesh/webgo/v6 v6.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin v1.7.2
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
)

Expand Down Expand Up @@ -179,6 +179,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin v1.7.2 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
Loading