From 4a76096db80e58edce2486f0b2cc8c0d17795088 Mon Sep 17 00:00:00 2001 From: yourok <8yourok8@mail.ru> Date: Fri, 20 Sep 2019 13:14:00 +0300 Subject: [PATCH] add get cache func --- src/server/torr/BTServer.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/server/torr/BTServer.go b/src/server/torr/BTServer.go index 67c668f..f984642 100644 --- a/src/server/torr/BTServer.go +++ b/src/server/torr/BTServer.go @@ -183,6 +183,16 @@ func (bt *BTServer) CacheState(hash metainfo.Hash) *state.CacheState { return cacheState } +func (bt *BTServer) GetCache(hash metainfo.Hash) *memcacheV2.Cache { + st := bt.GetTorrent(hash) + if st == nil { + return nil + } + + cacheState := bt.storage.GetCache(hash) + return cacheState.(*memcacheV2.Cache) +} + func (bt *BTServer) WriteState(w io.Writer) { bt.client.WriteStatus(w) }