Extends
Methods
size() → {Promise}
Get the length of the hash (keys length)
- Redis command: HLEN
- JavaScript analogy: Map.prototype.size
keys() → {Promise}
Get array of keys in the hash
- Redis command: HKEYS
- JavaScript analogy: Map.prototype.keys
delete(key) → {Promise}
Delete element in hash by it's key
- Redis command: HDEL
- JavaScript analogy: Map.prototype.delete
Parameters:
Name | Type | Description |
---|---|---|
key |
String |
Name of the key to delete |
has(key) → {Promise}
Check whether key exists in hash
- Redis command: HEXISTS
- JavaScript analogy: Map.prototype.has
Parameters:
Name | Type | Description |
---|---|---|
key |
String |
Key to check |
set(key, value) → {Promise}
Set value under given key
- Redis command: HSET
- JavaScript analogy: Map.prototype.set
Parameters:
Name | Type | Description |
---|---|---|
key |
String |
Key to set |
value |
String |
Value to set under given key |
get(key) → {Promise}
Get value by it's key
- Redis command: HGET
- JavaScript analogy: Map.prototype.get
Parameters:
Name | Type | Description |
---|---|---|
key |
String |
Key to get from hash |
values() → {Promise}
Get array of values from the hash
- Redis command: HVALS
- JavaScript analogy: Map.prototype.values
entries() → {Promise}
Returns 2-dimensional array of kind:
[[key1, value1], [key2, value2]]
To support Object to Map transformation
- Redis command: HGETALL
- JavaScript analogy: Map.prototype.entries
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 |
getAll() → {Promise}
Returns object representing hash structure This command has no analogy in JS
- Redis command: HGETALL
- JavaScript analogy: none
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 |
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: