
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
cache-manager-sqlite
Advanced tools
A modern SQlite cache store for node-cache-manager. Featuring:
async
/await
support with Promisemset
/mget
supportjson
or cbor
default: cbor
)The goal was to have a local key value storage built on top of proven technology. While other options like node-cache-manager-fs-binary have similar functionality; they are littered with all sort of problems from race conditions, (multi-process) to corruption. SQLite on the other end has been battle tested, and using WAL allows multiple node processes (forked web servers) to share the same cache across various processes, without the headaches of flat file based systems.
SQLite based storage is ideal for:
npm i cache-manager-sqlite
const sqliteStore = require('cache-manager-sqlite')
const cacheManager = require('cache-manager')
// SQLite :memory: cache store
const memStoreCache = cacheManager.caching({
store: sqliteStore,
options: {
serializer: 'cbor', // default is 'json'
ttl: 20 // TTL in seconds
}
})
// On disk cache on employees table
const cache = cacheManager.caching({
store: sqliteStore,
name: 'employees',
path: '/tmp/cache.db',
options: {
serializer: 'cbor'
}
})
// TTL in seconds
await cache.set('foo', {test: 'bar'}, {ttl: 10})
const value = await cache.get('foo')
const cacheManager = require('cache-manager')
const redisStore = require('cache-manager-ioredis')
const sqliteStore = require('cache-manager-sqlite')
const redisCache = cacheManager.caching({ store: redisStore, db: 0, ttl: 600 })
const sqliteCache = cacheManager.caching({ store: sqliteStore, path: '/tmp/cache.db', name: 'users', options: { ttl: 600 } })
const multiCache = cacheManager.multiCaching([sqliteCache, redisCache])
// Basic get/set
await multiCache.set('foo2', 'bar2', { ttl: customTTL })
const v = await multiCache.get('foo2')
// Wrap call example
const userId = 'user-1'
// Optionally pass ttl
await multiCache.wrap(userId, { ttl: customTTL }, async () => {
console.log("Calling expensive service")
await getUserFromExpensiveService(userId)
})
// set and get multiple
await multiCache.mset('foo1', 'bar1', 'foo0', 'bar0') //Uses default TTL
await multiCache.mset('foo1', 'bar1', 'foo3', 'bar3', {ttl: customTTL})
await multiCache.mget('foo1', 'foo3')
The node-cache-manager-sqlite
is licensed under the MIT license.
FAQs
A modern SQLite store for node-cache-manager
The npm package cache-manager-sqlite receives a total of 75 weekly downloads. As such, cache-manager-sqlite popularity was classified as not popular.
We found that cache-manager-sqlite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.