API reference
GDRedisClient
Client for one Redis connection. Regular methods suspend only their caller; *_async returns Signals for concurrent composition.
Methods
open(host: String = "127.0.0.1", port: int = 6379, opts: Dictionary = { }) -> Variant, Errquery(cmd: String, args: Array = []) -> Variant, Errpipeline(cmds: Array) -> Array, Errtransaction(cmds: Array) -> Array, Errsubscribe(channels: PackedStringArray) -> Variant, Erropen_async(host: String = "127.0.0.1", port: int = 6379, opts: Dictionary = { }) -> await Variant, Errquery_async(cmd: String, args: Array = []) -> await Variant, Errpipeline_async(cmds: Array) -> await Array, Errtransaction_async(cmds: Array) -> await Array, Errsubscribe_async(channels: PackedStringArray) -> await Variant, Erris_open() -> boolis_subscribed() -> boolin_flight() -> intclose() -> void
open
open(host: String = "127.0.0.1", port: int = 6379, opts: Dictionary = { }) -> Variant, ErrConnect and immediately authenticate when a password is supplied. Return a signal whose completion carries a value and an Err.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
host | String | "127.0.0.1" | Hostname or IP address used for connecting or binding. |
port | int | 6379 | Network port number. A listening port of zero lets the OS select a port. |
opts | Dictionary | { } | Named options for this operation. Omitted entries use their documented defaults. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
query
query(cmd: String, args: Array = []) -> Variant, ErrSend one command and read one reply; additional commands may queue without waiting.
Return a command value and Err. A missing value is NOT_FOUND with info.code=nil; null elements within array replies remain null. Binary bulk values remain PackedByteArray.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
cmd | String | Required | Command name; argument values are passed separately. |
args | Array | [] | Arguments in call or parameter-binding order. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
A WATCH abort returns Err.INTERRUPTED with e.info.code == "tx_failed". The size of one send follows the server's limits.
pipeline
pipeline(cmds: Array) -> Array, ErrSend a pipeline and collect replies as an array in one round trip. Each command has the form ["SET", "k", "v"].
Always return an Array in command order, including one-command pipelines. Failure retains known replies and marks unknown replies with Err.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
cmds | Array | Required | Commands in execution order, each represented by its command and argument values. |
Return value
Array, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
transaction
transaction(cmds: Array) -> Array, ErrWrap commands in MULTI and EXEC for transactional execution.
Return command results and Err. WATCH abort is INTERRUPTED with info.code=tx_failed; command failures retain sibling results.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
cmds | Array | Required | Commands in execution order, each represented by its command and argument values. |
Return value
Array, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
subscribe
subscribe(channels: PackedStringArray) -> Variant, ErrBegin subscription reads and emit message for each received item.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
channels | PackedStringArray | Required | Channel names to subscribe to. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
open_async
open_async(host: String = "127.0.0.1", port: int = 6379, opts: Dictionary = { }) -> await Variant, ErrConnect and immediately authenticate when a password is supplied. Return a signal whose completion carries a value and an Err.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
host | String | "127.0.0.1" | Hostname or IP address used for connecting or binding. |
port | int | 6379 | Network port number. A listening port of zero lets the OS select a port. |
opts | Dictionary | { } | Named options for this operation. Omitted entries use their documented defaults. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
query_async
query_async(cmd: String, args: Array = []) -> await Variant, ErrSend one command and read one reply; additional commands may queue without waiting.
Return a command value and Err. A missing value is NOT_FOUND with info.code=nil; null elements within array replies remain null. Binary bulk values remain PackedByteArray.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
cmd | String | Required | Command name; argument values are passed separately. |
args | Array | [] | Arguments in call or parameter-binding order. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
A WATCH abort returns Err.INTERRUPTED with e.info.code == "tx_failed". The size of one send follows the server's limits.
pipeline_async
pipeline_async(cmds: Array) -> await Array, ErrSend a pipeline and collect replies as an array in one round trip. Each command has the form ["SET", "k", "v"].
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
cmds | Array | Required | Commands in execution order, each represented by its command and argument values. |
Return value
await Array, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
transaction_async
transaction_async(cmds: Array) -> await Array, ErrWrap commands in MULTI and EXEC for transactional execution.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
cmds | Array | Required | Commands in execution order, each represented by its command and argument values. |
Return value
await Array, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
subscribe_async
subscribe_async(channels: PackedStringArray) -> await Variant, ErrBegin subscription reads and emit message for each received item.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
channels | PackedStringArray | Required | Channel names to subscribe to. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
is_open
is_open() -> bool---------------- Connections ----------------
Parameters
No parameters.
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
is_subscribed
is_subscribed() -> boolReturn whether this connection is in subscription mode.
Parameters
No parameters.
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
in_flight
in_flight() -> intCount commands queued for encoding or awaiting server replies.
Parameters
No parameters.
Return value
int
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
close
close() -> voidClose and release retained resources.
Parameters
No parameters.
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.