3.0.0 • Published 7 months ago
@varasto/memory-storage v3.0.0
@varasto/memory-storage
Implementation of an storage which stores values in memory instead of hard disk or remote server.
Because it provides full storage implementation without persistence, it's useful for writing test cases for libraries/applications that use Varasto storages for storing data.
Installation
$ npm install --save @varasto/memory-storage
Usage
The package provides a class called MemoryStorage
which is an implementation
of Storage type.
Basic usage of the API looks like this:
import { MemoryStorage } from '@varasto/memory-storage';
const storage = new MemoryStorage();
Memory storage instance also has an additional clear()
method that will
remove either all data from the storage, or items from specified namespace.
storage.clear(); // Removes all data from the storage.
storage.clear('foo'); // Removes all items from namespace "foo".