Hash

Hash

new Hash()

Source:

Extends

Methods

size() → {Promise}

Get the length of the hash (keys length)

Source:

keys() → {Promise}

Get array of keys in the hash

Source:

delete(key) → {Promise}

Delete element in hash by it's key

Parameters:
Name Type Description
key String

Name of the key to delete

Source:

has(key) → {Promise}

Check whether key exists in hash

Parameters:
Name Type Description
key String

Key to check

Source:

set(key, value) → {Promise}

Set value under given key

Parameters:
Name Type Description
key String

Key to set

value String

Value to set under given key

Source:

get(key) → {Promise}

Get value by it's key

Parameters:
Name Type Description
key String

Key to get from hash

Source:

values() → {Promise}

Get array of values from the hash

Source:

entries() → {Promise}

Returns 2-dimensional array of kind:

[[key1, value1], [key2, value2]]

To support Object to Map transformation

Source:

getMul(keys) → {Promise}

Get multiple keys by passing an array of keys This command has no analogy in JS

  • Redis command: HMGET
  • JavaScript analogy: none
Parameters:
Name Type Description
keys Array.<String>

Keys to get values for

Source:

getAll() → {Promise}

Returns object representing hash structure This command has no analogy in JS

  • Redis command: HGETALL
  • JavaScript analogy: none
Source:

setMul(valuesObj) → {Promise}

Set multiple keys by passing an object with key-value structure This command has no analogy in JS

  • Redis command: HMSET
  • JavaScript analogy: none
Parameters:
Name Type Description
valuesObj Object

Object with key-value pairs to set

Source:

prom(method) → {function}

Return promisified version of Redis client's methods.

Uses util.promisify internally which is most native way of getting Promise. As all Redis commands have name of the key as first argument, we can and do set first argument with name/key of the storage/structure

Parameters:
Name Type Description
method String

Method to return promisified

Inherited From:
Source:

clear() → {Promise}

Remove any data type from global scope using DEL method and the key used in creation

Command might be used for debug clean-up, development purposes or for production reset of the storage

Inherited From:
Source: