Remove ristretto cache

This commit is contained in:
Ben Sarmiento
2023-12-06 01:11:58 +01:00
parent 121a28d46f
commit 4b8fd82acd
7 changed files with 63 additions and 226 deletions

View File

@@ -15,7 +15,6 @@ import (
"github.com/debridmediamanager/zurg/pkg/logutil"
"github.com/debridmediamanager/zurg/pkg/realdebrid"
"github.com/debridmediamanager/zurg/pkg/utils"
"github.com/dgraph-io/ristretto"
"github.com/julienschmidt/httprouter"
"github.com/panjf2000/ants/v2"
)
@@ -45,17 +44,7 @@ func MainApp(configPath string) {
utils.EnsureDirExists("data")
cache, err := ristretto.NewCache(&ristretto.Config{
NumCounters: 1e5, // 200,000 to track frequency for 100,000 items.
MaxCost: 100 << 20, // maximum cost of cache (100MB).
BufferItems: 1 << 10, // number of keys per Get buffer, can be adjusted.
})
if err != nil {
zurglog.Errorf("Failed to create cache: %v", err)
os.Exit(1)
}
torrentMgr := torrent.NewTorrentManager(config, rd, p, cache, log.Named("manager"))
torrentMgr := torrent.NewTorrentManager(config, rd, p, log.Named("manager"))
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), 0, config, log.Named("dlclient"))
getfile := universal.NewGetFile(downloadClient)