Hash
Methods for manipulating a hash on the redis server
Constructor Summary
Public Constructor | ||
public |
constructor(k: string) Instantly create a hash handler associated with a specific hash, via its key, sends no requests to the server until a method is called. |
Member Summary
Public Members | ||
public |
k: * |
Method Summary
Public Methods | ||
public |
delete a field from the hash (via HDEL) |
|
public |
delete the entire hash (via DEL) |
|
public |
return the selected field from the hash |
|
public |
returns the entire hash as a javascript Object, and will return {} if the hash does not exist (via HGETALL) |
|
public |
add amount to value of field f and return the new value (via HINCRBY) |
|
public |
incrByFloat(f: *, amount: *): Promise<number, Error> add amount to value of field f and return the new value (via HINCRBYFLOAT) |
|
public |
list the fields of this hash (via HKEYS) |
|
public |
number of fields in the hash (via HLEN) |
|
public |
set all fields of a hash sourced from a Javascript object, deletes entire hash first and recreates (via DEL and HMSET). |
|
public |
set an undefined field to a value, but has no effect if field exists (via HSETNX) |
|
public |
merges fields and values from a Javacript object into the hash (via HMSET) |
|
public |
list the values of this hash (via HVALS) |
Public Constructors
Public Members
public k: * source
Public Methods
public del(f: string): Promise<number, Error> source
delete a field from the hash (via HDEL)
Params:
Name | Type | Attribute | Description |
f | string | name of field to be deleted |
public get(f: string): Promise<string, Error> source
return the selected field from the hash
Params:
Name | Type | Attribute | Description |
f | string | The field name |
public getAll(): Promise<Object, Error> source
returns the entire hash as a javascript Object, and will return {} if the hash does not exist (via HGETALL)
public incrBy(f: *, amount: *): Promise<number, Error> source
add amount to value of field f and return the new value (via HINCRBY)
Params:
Name | Type | Attribute | Description |
f | * | field name |
|
amount | * | Integer amount to add |
public incrByFloat(f: *, amount: *): Promise<number, Error> source
add amount to value of field f and return the new value (via HINCRBYFLOAT)
Params:
Name | Type | Attribute | Description |
f | * | field name |
|
amount | * | Floating-point amount to add |
public set(obj: *): Promise<Array, Error> source
set all fields of a hash sourced from a Javascript object, deletes entire hash first and recreates (via DEL and HMSET). Clients reading at the same time may get either an empty object or the entire object.
Params:
Name | Type | Attribute | Description |
obj | * | Object containing fields and values to set hash |
public setnx(f: string, v: string): Promise<number, Error> source
set an undefined field to a value, but has no effect if field exists (via HSETNX)