List
Methods for manipulating a List on the server
Constructor Summary
Public Constructor | ||
public |
constructor(k: string) Instantly create a list handler associated with a specific list, 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 |
get the value of element i (via LINDEX) |
|
public |
get the entire list (via LRANGE) |
|
public |
insert an element immediately after the first element equal to pivot (via LINSERT) |
|
public |
insert an element immediately before the first element equal to pivot (via LINSERT) |
|
public |
length of list (via LLEN) |
|
public |
remove the tail from the list and return it (via RPOP) |
|
public |
remove the tail from the list and append (unshift) it as the head of another list (via RPOPLPUSH) |
|
public |
append values to the tail of the list (via RPUSH) |
|
public |
remove elements with value v (via LREM) |
|
public |
set element i to value v (via LSET) |
|
public |
set list to supplied values (via DEL and RPUSH) |
|
public |
remove element 0 from the list and return it, and re-index the list (via LPOP) |
|
public |
return all or part of the list, list is unchanged (via LRANGE) |
|
public |
trim list to only the indicated range of indexes and reindex (via LTRIM) |
|
public |
append to beginning of list, in reverse order, and re-index the list (via LPUSH) |
Public Constructors
Public Members
public k: * source
Public Methods
public get(i: *): Promise<string, Error> source
get the value of element i (via LINDEX)
Params:
Name | Type | Attribute | Description |
i | * | index to fetch |
public insertAfter(pivot: string, v: string): Promise<number, Error> source
insert an element immediately after the first element equal to pivot (via LINSERT)
public insertBefore(pivot: string, v: string): Promise<number, Error> source
insert an element immediately before the first element equal to pivot (via LINSERT)
public popTo(destination: string): Promise<Array, Error> source
remove the tail from the list and append (unshift) it as the head of another list (via RPOPLPUSH)
Params:
Name | Type | Attribute | Description |
destination | string | key to List receiving the element |
public push(values: ...string): Promise<number, Error> source
append values to the tail of the list (via RPUSH)
Params:
Name | Type | Attribute | Description |
values | ...string | to append to the tail of the list |
public remove(v: string, count: nunber): Promise<number, Errpr> source
remove elements with value v (via LREM)
Params:
Name | Type | Attribute | Description |
v | string | the value to remove |
|
count | nunber |
|
0 for all occurrences, otherwise limit the number of removals |
public setAll(values: ...string): Promise<number, Error> source
set list to supplied values (via DEL and RPUSH)
Params:
Name | Type | Attribute | Description |
values | ...string | Values to set |
public shift(): Promise<string, Error> source
remove element 0 from the list and return it, and re-index the list (via LPOP)
public slice(from: number, to: number): Promise<Array, Error> source
return all or part of the list, list is unchanged (via LRANGE)
public trim(from: number, to: number): Promise<Array, Error> source
trim list to only the indicated range of indexes and reindex (via LTRIM)