[#419] cmd/node: Cache containers read from sidechain

Implement LRU cache for values read from the network. Implement LRU cache of
containers read from sidechain. Use it as a container storage in neofs-node
app. Current cache size is set to 100, TTL is 30s (constants).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-03-04 12:26:47 +03:00 committed by Leonard Lyubich
parent ed808c3f1b
commit 34a51ed38b
2 changed files with 111 additions and 1 deletions

View file

@ -53,7 +53,7 @@ func initContainerService(c *cfg) {
wrap, err := wrapper.New(cnrClient)
fatalOnErr(err)
c.cfgObject.cnrStorage = wrap // use RPC node as source of containers
c.cfgObject.cnrStorage = newCachedContainerStorage(wrap) // use RPC node as source of containers (with caching)
c.cfgObject.cnrClient = wrap
localMetrics := &localStorageLoad{