Add caching
This commit is contained in:
@@ -4,10 +4,12 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/debridmediamanager.com/zurg/internal/config"
|
||||
"github.com/debridmediamanager.com/zurg/internal/dav"
|
||||
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
||||
"github.com/hashicorp/golang-lru/v2/expirable"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -18,8 +20,11 @@ func main() {
|
||||
|
||||
t := torrent.NewTorrentManager(c)
|
||||
|
||||
cache := expirable.NewLRU[string, string](1e4, nil, time.Hour)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
dav.Router(mux, c, t)
|
||||
dav.Router(mux, c, t, cache)
|
||||
|
||||
addr := fmt.Sprintf(":%s", c.GetPort())
|
||||
log.Printf("Starting server on %s\n", addr)
|
||||
err := http.ListenAndServe(addr, mux)
|
||||
|
||||
Reference in New Issue
Block a user