2.1.1 • Published 2 months ago

@keyvhq/multi v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@keyvhq/multi

A multi storage adapter to manage local and remote store as one for Keyv.

Install

npm install --save @keyvhq/multi

Usage

First, you need to provide your local and remote stores to be used, being possible to use any Keyv storage adapter:

const KeyvMulti = require('@keyvhq/multi')
const KeyvRedis = require('@keyvhq/redis')
const Keyv = require('@keyvhq/core')

const keyv = new Keyv({
  store: new KeyvMulti({
    local: new Map(),
    remote: new KeyvRedis()
  })
})

After that, just interact with the store as a single keyv instance.

The actions will be performed in parallel when is possible, and the stores will fallback between them to keep them in synchronized.

API

multi([options])

options

local

Type: Object Default: new Keyv()

A keyv instance to be used as local strategy.

remote

Type: Object Default: new Keyv()

A keyv instance to be used as remote strategy.

validator

Type: Function Default: () => true

The validator function is used as a precondition to determining is remote storage should be checked.

License

@keyvhq/multi © Jytesh, released under the MIT License. Maintained by Microlink with help from contributors.

microlink.io · GitHub microlinkhq · Twitter @microlinkhq

2.1.1

2 months ago

2.1.0

9 months ago

2.0.3

1 year ago

2.0.0-beta.0

1 year ago

2.0.0

1 year ago

1.6.26

1 year ago

1.6.13

2 years ago

1.6.14

2 years ago

1.6.9

2 years ago

1.6.8

2 years ago

1.6.6

2 years ago

1.6.5

2 years ago

1.6.4

2 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago