catbox-memory

API v6.0.x

Installation:

npm: npm install @hapi/catbox-memory

yarn: yarn add @hapi/catbox-memory

new CatboxMemory.Engine(options)

  • maxByteSize - sets an upper limit on the number of bytes that can be stored in the cache. Once this limit is reached no additional items will be added to the cache until some expire. The utilized memory calculation is a rough approximation and must not be relied on. Defaults to 104857600 (100MB).
  • minCleanupIntervalMsec - the minimum number of milliseconds in between each cache cleanup. Defaults to 1 second (1000).
  • cloneBuffersOnGet - by default, buffers stored in the cache are copied when they are set but not when they are retrieved. This means a change to the buffer returned by a get() will change the value in the cache. To prevent this, set cloneBuffersOnGet to true to always return a copy of the cached buffer. Defaults to false.
clipboard