put blocks in cache after get

This commit is contained in:
Jeromy 2020-05-29 15:15:59 -07:00
parent 94555ea8c1
commit bac1e3f901

View File

@ -47,7 +47,13 @@ func (bs *CacheBS) Get(c cid.Cid) (block.Block, error) {
return v.(block.Block), nil
}
return bs.bs.Get(c)
out, err := bs.bs.Get(c)
if err != nil {
return nil, err
}
bs.cache.Add(c, out)
return out, nil
}
func (bs *CacheBS) GetSize(c cid.Cid) (int, error) {