Key
Methods for manipulating a single key on the redis server
Constructor Summary
Public Constructor | ||
public |
constructor(k: string) Instantly create a key hander associated with a specific key, sends no requests to the server until a method is called. |
Member Summary
Public Members | ||
public |
k: * |
Method Summary
Public Methods | ||
public |
string append to the current value (via APPEND) |
|
public |
decrement integer key value by 1 and return decremented value (via DECR) |
|
public |
decrement integer key value by integer amount and return decremented value (via DECRBY) |
|
public |
delete key (via DEL) |
|
public |
check key existence (via EXISTS) |
|
public |
set a delta timer for autodeletion (via EXPIRE) Untested. |
|
public |
set a unix timestamp for autodeletion (not a JS timestamp, needs to be divided by 1000) (EXPIREAT) Untested. |
|
public |
get the current value (via GET) |
|
public |
return a substring of the current string value (via GETRANGE) |
|
public |
set a new value, return the previous value (via GETSET) |
|
public |
add 1 to the current value and return the new value (via INCR) |
|
public |
add integer amount to the current value and return the new value (via INCRBY) |
|
public |
incrByFloat(amount: number): * add floating point amount to the curent value and return the new value (via INCRBYFLOAT) |
|
public |
moveToDB(db: *): * |
|
public |
pExpire(ms: *): * |
|
public |
pExpireAt(jsts: *): * |
|
public |
pSetEx(ms: *, v: *): * |
|
public |
pTTL(): * |
|
public |
persist(): * |
|
public |
rename key, potentially clobbering/overwriting key at new name (via RENAME) |
|
public |
set the value (via SET) |
|
public |
setEx(sec: *, v: *): * |
|
public |
overwrite string value with new value beginning at character offset |
|
public |
set the value only if the key is undefined (via SETNX) |
|
public |
get string length of value |
|
public |
ttl(): * |
|
public |
type(): * |
Public Constructors
Public Members
public k: * source
Public Methods
public append(v: *): Promise<number, Error> source
string append to the current value (via APPEND)
Params:
Name | Type | Attribute | Description |
v | * |
public decr(): Promise<number, Error> source
decrement integer key value by 1 and return decremented value (via DECR)
public decrBy(amount: *): Promise<number, Error> source
decrement integer key value by integer amount and return decremented value (via DECRBY)
Params:
Name | Type | Attribute | Description |
amount | * | Amount to subtract. |
public expire(seconds: *): Promise<number, Error> source
set a delta timer for autodeletion (via EXPIRE) Untested.
Params:
Name | Type | Attribute | Description |
seconds | * | Seconds until auto-deletion, subject to redis expiration rules |
public expireAt(unixts: *): Promise<number, Error> source
set a unix timestamp for autodeletion (not a JS timestamp, needs to be divided by 1000) (EXPIREAT) Untested.
Params:
Name | Type | Attribute | Description |
unixts | * | Unix timetamp for autodeletion in seconds since Jan 1, 1970 00:00 UTC |
public getRange(starts: *, ends: *): Promise<string, Error> source
return a substring of the current string value (via GETRANGE)
Params:
Name | Type | Attribute | Description |
starts | * |
|
beginning index (0 is beginning) |
ends | * |
|
ending index (-1 is end of string) |
public getSet(v: *): Promise<string, Error> source
set a new value, return the previous value (via GETSET)
Params:
Name | Type | Attribute | Description |
v | * | new value |
public incr(): Promise<number, Error> source
add 1 to the current value and return the new value (via INCR)
public incrBy(amount: number): * source
add integer amount to the current value and return the new value (via INCRBY)
Params:
Name | Type | Attribute | Description |
amount | number | Integer amount to add |
Return:
* |
public incrByFloat(amount: number): * source
add floating point amount to the curent value and return the new value (via INCRBYFLOAT)
Params:
Name | Type | Attribute | Description |
amount | number | Floating point amount to add |
Return:
* |
public rename(newk: string): Promise<Array, Error> source
rename key, potentially clobbering/overwriting key at new name (via RENAME)
Params:
Name | Type | Attribute | Description |
newk | string | new key |
public set(v: string): Promise<Array, Error> source
set the value (via SET)
Params:
Name | Type | Attribute | Description |
v | string | New value |
public setRange(offset: number): Promise<number, Error> source
overwrite string value with new value beginning at character offset
Params:
Name | Type | Attribute | Description |
offset | number | Offset, where 0 is beginning of string |
public setnx(v: *): Promise<number, Error> source
set the value only if the key is undefined (via SETNX)
Params:
Name | Type | Attribute | Description |
v | * | Value to set if key is undefined |