Skip to content

Commit

Permalink
chore: better proxy cache
Browse files Browse the repository at this point in the history
  • Loading branch information
calmh committed Dec 11, 2024
1 parent b069d5e commit 0dfdc56
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module github.com/syncthing/apt-web

go 1.23.2
go 1.23.4

require github.com/meerkat-dashboard/meerkat v0.0.0-20240605084813-bc196007bb0c
require calmh.dev/proxy v0.0.0-20241211092212-0b1edd17f719

require (
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
golang.org/x/sync v0.10.0 // indirect
)
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
github.com/meerkat-dashboard/meerkat v0.0.0-20240605084813-bc196007bb0c h1:jwuFa8OpeTeXT3EOq5IsiTiYKlaOU4isntQlDbZkBp8=
github.com/meerkat-dashboard/meerkat v0.0.0-20240605084813-bc196007bb0c/go.mod h1:2qaHfLheTyaCMPpcjl/hUmRPdByJrZWQAAEn1ClllTA=
calmh.dev/proxy v0.0.0-20241211092212-0b1edd17f719 h1:BePk+UiIug8XJ3l7r71nnqcgWTGX1069sHiJ3ZZ75ak=
calmh.dev/proxy v0.0.0-20241211092212-0b1edd17f719/go.mod h1:jlSCq6Yg3xwM6afXvjPtH4iWY1/b4kXpi0aOnsxxRuI=
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ=
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
7 changes: 2 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"path"
"time"

cacheProxy "github.com/meerkat-dashboard/meerkat/proxy"
"calmh.dev/proxy"
)

//go:embed site
Expand Down Expand Up @@ -74,9 +74,6 @@ func newCachingProxy(next string, cacheTime time.Duration) (http.Handler, error)
r.SetURL(remote)
},
}
cp := &cacheProxy.Proxy{}
cp.Next = rev
rev.ModifyResponse = cp.StoreOKResponse(cacheTime)

return cp, nil
return proxy.New(cacheTime, 100, rev), nil
}

0 comments on commit 0dfdc56

Please sign in to comment.