Skip to content

Commit

Permalink
remove and deprecate lru (server side caching) - library had bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
gilmaimon committed Jul 27, 2024
1 parent 5a5ddb8 commit 4ad7744
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 224 deletions.
3 changes: 0 additions & 3 deletions config-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ cache:
enabled: true
time_in_hours: 4

lru:
enabled: true

tls:
port: 443
enabled: false
Expand Down
3 changes: 0 additions & 3 deletions server-v2/config/serverconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ type ServerConfiguration struct {
Libraries struct {
RefreshRateHours int64 `yaml:"refresh_rate_hours"`
} `yaml:"libraries"`
LRU struct {
Enabled bool `yaml:"enabled"`
} `yaml:"lru"`
}

func ReadServerConfiguration(path string) ServerConfiguration {
Expand Down
2 changes: 1 addition & 1 deletion server-v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.21

require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/SporkHubr/echo-http-cache v0.0.0-20200706100054-1d7ae9f38029
github.com/essentialkaos/go-badge v1.4.1
github.com/labstack/echo/v4 v4.12.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -24,4 +23,5 @@ require (
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)
174 changes: 0 additions & 174 deletions server-v2/go.sum

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions server-v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,23 @@ func main() {
middlewares.EnableLogging(server)
}

if configuration.LRU.Enabled {
middlewares.EnableServerCaching(server)
}

server.Static("/", configuration.Server.StaticDir)
// Static files
server.Static("/static", configuration.Server.StaticDir+"/static")
server.File("/favicon.png", configuration.Server.StaticDir+"/favicon.png")
server.GET("/manifest.json", func(c echo.Context) error {
return c.File(configuration.Server.StaticDir + "/manifest.json")
})

// handlers and routes
// API routes
server.GET("/stats/recent", (&handlers.RecentHandler{LibrariesDal: dal}).Handle)
server.GET("/library/:library", (&handlers.LibraryHandler{LibrariesDal: dal}).Handle)
server.GET("/badge/:library", (&handlers.BadgeHandler{
LibrariesDal: dal,
BadgeGenerator: badgeGenerator,
}).Handle)

server.GET("/*", func(c echo.Context) error {
// Catch-all route for single-page application (SPA)
server.GET("*", func(c echo.Context) error {
return c.File(configuration.Server.StaticDir + "/index.html")
})

Expand Down
32 changes: 0 additions & 32 deletions server-v2/middlewares/lru.go

This file was deleted.

5 changes: 1 addition & 4 deletions server-v2/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ cache:
enabled: true
time_in_hours: 4

lru:
enabled: true

tls:
port: 443
enabled: true
enabled: false
crt_file: ../cert.pem
key_file: ../privkey.pem

Expand Down

0 comments on commit 4ad7744

Please sign in to comment.