codex-storage / nim-codex

Decentralized Durability Engine
https://codex.storage
Apache License 2.0
68 stars 25 forks source link

Wire up Memory cache #357

Open benbierens opened 1 year ago

benbierens commented 1 year ago

An in-memory cache implementing either 'datastore' or 'blockstore' abstraction can help improve performance for slow storage devices. Memory cache should use a least-recently-used approach. Memory cache size should be adjustable from config. Memory cache feature should be able to be disabled from config.

Consider adjusting current 'CacheStore'.

emizzle commented 1 year ago

Memory cache should use a least-recently-used approach.

This should already be the case, no?

type
  CacheStore* = ref object of BlockStore
    currentSize*: Natural          # in bytes
    size*: Positive                # in bytes
    cache: LruCache[Cid, Block]