Set

Set

Class to handle Redis SET type

Constructor

new Set()

Source:

Extends

Methods

add(…el) → {Promise}

Add element(s) to the set Command: SADD

Parameters:
Name Type Attributes Description
el Array.<String> | String <repeatable>

Element or elements to add

Source:

size() → {Promise}

Get size of the set (number of elements in it) Command: SCARD

Source:

has(el) → {Promise}

Check whether element is present in a set Command: SISMEMBER

Parameters:
Name Type Description
el String

Element to check for

Source:

values() → {Promise}

Get all members of set as array Command: SMEMBERS

Source:

pop(count) → {Promise}

Remove random element or number of elements from a set Command: SPOP

Parameters:
Name Type Description
count Number

Number of elements to remove

Source:

delete(…el) → {Promise}

Delete element(s) from a set Command: SREM

Parameters:
Name Type Attributes Description
el String <repeatable>

Element(s) to remove

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: