resolve-snapshot-lite
v0.23.2
Published
An adapter used to save snapshots to a file or in memory.
Downloads
9
Readme
resolve-snapshot-lite
This package is an adapter for storing snapshots using a file or memory. It does not have binary dependencies and does not require additional applications (like MongoDB or SQL server).
Available Parameters
bucketSize
- the bucket size.databaseFile
- the path to a file where snapshots are stored. Notice, if that argument is not passed the adapter uses memory to store snapshots. In this case, all data is lost when an application instance is restarted.
Usage
import createSnapshotAdapter from 'resolve-snapshot-lite'
const snapshotAdapter = createSnapshotAdapter({
databaseFile: 'path/to/file',
bucketSize: 100
})
await snapshotAdapter.loadSnapshot(key)
await snapshotAdapter.saveSnapshot(key, value)
await snapshotAdapter.dispose({ dropSnapshots: true })