add get cache func

This commit is contained in:
yourok
2019-09-20 13:16:45 +03:00
parent f802d1f94c
commit 8fe294b201

View File

@@ -44,6 +44,15 @@ func (s *Storage) GetStats(hash metainfo.Hash) *state.CacheState {
return nil
}
func (s *Storage) GetCache(hash metainfo.Hash) interface{} {
s.mu.Lock()
defer s.mu.Unlock()
if c, ok := s.caches[hash]; ok {
return c
}
return nil
}
func (s *Storage) CloseHash(hash metainfo.Hash) {
if s.caches == nil {
return