Open ajnavarro opened 1 year ago
So your proposal is to have a LRU cache which additionally has some disk-backed data for cache misses?
Could another solution not be of requiring "temporary" / "throwaway" packages added with SetCachePackage
to be finalised?
@thehowl Yes, that might be another solution. However, we will need more research about the actual codebase to check where this method is used to ensure we can modify the behavior.
Description
After trying to reduce the memory usage moving from maps to an LRU cache here (https://github.com/gnolang/gno/pull/780), I realized that packages set on
cacheObjects
are not expected to be evicted, causing problems if we use an LRU cache.Possible Solution
We can store these packages on persistent storage using a special key like
/tmp/[UUID]/oid:[OID]
where [UUID] is a unique ID created per storage session (every time you initialise a store or purge it)When purging cache calling
ClearObjectCache
we generate a new UUID and we remove all keys under the previous UUID/tmp/[UUID]
On every server restart, we remove all keys under
/tmp
WDYT?