cxKV

cxKV

Key Value Store, Globally Synced Atomic and Eventually Consistent

Example

const {ko, kv, incr, keys, usage} = require('cxKV');
async function main(data) {
  await kv.set('hello', 'world');
  await ko.set('record', {hello: 'world'});
  let a = await kv.get('hello');
  let b = await ko.get('record');
  return {a, b};
}

Methods

(static) get(params) → {Promise}

Source:

Get Value (Stored as a String)

Example
await kv.get('hello');
Parameters:
Name Type Description
params string

Key

Returns:
Type
Promise

(static) get(params) → {Promise}

Source:

Get Value (Stored as a Object)

Example
await ko.get('record');
Parameters:
Name Type Description
params string

Key

Returns:
Type
Promise

(static) incr(params, params) → {Promise}

Source:

Increment

Example
var newValue = await incr('counter');
Parameters:
Name Type Description
params string

Key

params integer

Increment by

Returns:
Type
Promise

(static) keys() → {Promise}

Source:

Key All Keys

Example
var allKeys = await keys();
Returns:
Type
Promise

(static) set(params, msg) → {Promise}

Source:

Set Value (Stored as a String)

Example
await kv.set('hello', 'world');
Parameters:
Name Type Description
params string

Key

msg string

Value

Returns:
Type
Promise

(static) set(params, msg) → {Promise}

Source:

Set Value (Stored as a String)

Example
await ko.set('record', {hello: 'world'});
Parameters:
Name Type Description
params string

Key

msg object

Value

Returns:
Type
Promise

(static) usage() → {Promise}

Source:

Get Usage

Example
var currentUsage = await usage();
Returns:
Type
Promise