These changes implement a least-recently-used functionality, and smooth out how often and how aggressive blockmap.cleanup() is called. I will benchmark this change to see if it helps with download speed.
It looks good, except for the last access update which seems quite intrusive and easily forgettable when we add new methods. What about recording that through the BlockMap accesses instead? All the code get block indexes from the BlockMap, and they should not keep the loaded references. So we could record the last access when a block index is requested.
It looks good, except for the last access update which seems quite intrusive and easily forgettable when we add new methods. What about recording that through the BlockMap accesses instead? All the code get block indexes from the BlockMap, and they should not keep the loaded references. So we could record the last access when a block index is requested.