Add caching
This commit is contained in:
@@ -6,17 +6,18 @@ import (
|
||||
|
||||
"github.com/debridmediamanager.com/zurg/internal/config"
|
||||
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
||||
"github.com/hashicorp/golang-lru/v2/expirable"
|
||||
)
|
||||
|
||||
// Router creates a WebDAV router
|
||||
func Router(mux *http.ServeMux, c config.ConfigInterface, t *torrent.TorrentManager) {
|
||||
func Router(mux *http.ServeMux, c config.ConfigInterface, t *torrent.TorrentManager, cache *expirable.LRU[string, string]) {
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case "PROPFIND":
|
||||
HandlePropfindRequest(w, r, t, c)
|
||||
HandlePropfindRequest(w, r, t, c, cache)
|
||||
|
||||
case http.MethodGet:
|
||||
HandleGetRequest(w, r, t, c)
|
||||
HandleGetRequest(w, r, t, c, cache)
|
||||
|
||||
case http.MethodOptions:
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
Reference in New Issue
Block a user