npm.io
4.2.3 • Published 3 years ago

@accumulators/core

Licence
GPL-3.0-or-later
Version
4.2.3
Deps
0
Size
11 kB
Vulns
0
Weekly
0
Stars
11

core

Store

Store is a class that provides a simple interface for storing and retrieving key-value pairs.

Store has the following interface:

interface IStore {
  get(key: string): Promise<string | undefined>;
  getMany(keys: string[]): Promise<Map<string, string>>;

  set(key: string, value: string): Promise<void>;
  setMany(values: Map<string, string>): Promise<void>;

  delete(key: string): Promise<void>;
  deleteMany(keys: string[]): Promise<void>;
}

Implementations

Store can be implemented in many different ways, for example in memory or database.

Currently there are three implementations:

You can also implement your own store. Just write a class that implements IStore interface and you are good to go.