catbox-memory
Memory adapter for catbox. This adapter is not designed to share a common cache between multiple processes (e.g. in a cluster mode). It uses a single interval timeout to look for expired records and clean them from memory.
Lead Maintainer - Wyatt Preul
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 to104857600
(100MB).minCleanupIntervalMsec
- the minimum number of milliseconds in between each cache cleanup. Defaults to 1 second (1000
).allowMixedContent
- by default, all data is cached as JSON strings, and converted to an object usingJSON.parse()
on retrieval. By setting this option totrue
,Buffer
data can be stored alongside the stringified data.Buffer
s are not stringified, and are copied before storage to prevent the value from changing while in the cache. Defaults tofalse
.cloneBuffersOnGet
- by default, buffers stored in the cache withallowMixedContent
set totrue
are copied when they are set but not when they are retrieved. This means a change to the buffer returned by aget()
will change the value in the cache. To prevent this, setcloneBuffersOnGet
totrue
to always return a copy of the cached buffer. Defaults tofalse
.