lmvalkey reference
Complete command-line flag reference, integrated HTTP REST endpoints, host schema types and methods, standard lmcode_std_v3 REST and CLI interfaces, and exit codes for lmvalkey v0.1.0.
Server and host CLI flags
| Flag or environment variable | Arguments / default | Description |
|---|---|---|
| --version / -v | none | Print the lmvalkey server version string (lmvalkey v=0.1.0) and exit 0. |
| --port | <port> (default 6379) | TCP port for native Valkey/Redis RESP connections (also auto-detects incoming HTTP REST requests). |
| --rest-port | <port> | Dedicated TCP port for the integrated zero-auth HTTP JSON REST server (for example, 8080). |
| --bind | <addr> (default 127.0.0.1) | Bind RESP and REST listeners to the specified network interface addresses. |
| --daemonize | yes | no (default no) | Run the lmvalkey server as a background daemon process. |
| --requirepass | <password> | Require AUTH password on native RESP connections (HTTP REST endpoints remain unauthenticated). |
| --lmcode | <file.dslb> | Load and execute a compiled LMScript bytecode file against the embedded lmvalkey schema. |
| --lmcode-schema | [--json] | Print the exact embedded lmvalkey schema JSON bytes to stdout and exit 0. |
| --lmcode-signatures | none | Print all 245 canonical context, function, and method signatures (19 host + 226 standard library). |
| VALKEY_HOST / REDIS_HOST | 127.0.0.1 | Target host IPv4 address used by _lmcode_ ValkeyClient connections before falling back to in-memory mode. |
| VALKEY_PORT / REDIS_PORT | 6379 | Target TCP port used by _lmcode_ ValkeyClient connections. |
Integrated HTTP REST endpoints
| HTTP method | Path pattern | Request body | Response envelope |
|---|---|---|---|
| GET | / | none | {"ok":true,"result":...} server health and status summary. |
| GET | /ping | none | {"ok":true,"result":"PONG"}. |
| GET | /get/<key> | none | {"ok":true,"result":"<value>"} (or null if key does not exist). |
| POST | /set/<key> | raw value bytes | {"ok":true,"result":"OK"} after storing the request body under <key>. |
| POST | /set/<key>/<val> | none | {"ok":true,"result":"OK"} after storing <val> under <key>. |
| GET | /keys | none | {"ok":true,"result":["k1","k2",...]} listing all keys (KEYS *). |
| GET | /keys/<pattern> | none | {"ok":true,"result":[...]} listing keys matching the glob pattern (such as user:*). |
| PUT | /keys/<key> | raw value bytes | {"ok":true,"result":"OK"} RESTful key upsert from request body. |
| DELETE | /keys/<key> | none | {"ok":true,"result":1} (number of deleted keys). |
| POST | /cmd | ["CMD","arg1",...] or {"command":"CMD","args":[...]} | {"ok":true,"result":...} executing any Valkey command against the unified datastore. |
Host schema types, methods, and functions
| Type / context | Method signature | Description |
|---|---|---|
| context valkey: Valkey | valkey.set(string, string) -> bool | Execute SET key value and return true when the server replies OK. |
| Valkey | valkey.get(string) -> string | Execute GET key and return the stored string value (or "" when absent). |
| Valkey | valkey.del(string) -> int | Execute DEL key and return the integer count of removed keys. |
| Valkey | valkey.exists(string) -> bool | Execute EXISTS key and return true when the key is present. |
| Valkey | valkey.cmd(string) -> string | valkey.cmd(string, string) -> string | valkey.cmd(string, string, string) -> string | Execute an arbitrary 1-, 2-, or 3-token Valkey command and return the reply string (or JSON array string for multi-bulk replies). |
| Valkey | valkey.batch() -> Batch | Create a new pipelined command batch associated with the current ValkeyClient. |
| Batch | b.set(string, string) -> Batch | b.get(string) -> Batch | b.del(string) -> Batch | Append a SET, GET, or DEL command to the batch pipeline and return the Batch receiver. |
| Batch | b.cmd(string) -> Batch | b.cmd(string, string) -> Batch | b.cmd(string, string, string) -> Batch | Append an arbitrary 1-, 2-, or 3-token command to the batch pipeline and return the Batch receiver. |
| Batch | b.len() -> int | b.clear() -> void | Return the number of queued commands in the batch or clear all queued commands. |
| Batch | b.exec() -> string | Send all queued commands in a single pipelined round-trip and return a JSON array string of reply strings. |
| function print | print(string) -> void | Write a string followed by a newline to stdout. |
Standard lmcode_std_v3 REST and CLI interfaces
| Interface or function | Signature / annotation | Description |
|---|---|---|
| RestGet .. RestOptions | @"/path/:param" fn h(x: RestExchange) -> void implements RestGet | Bind an HTTP GET, POST, PUT, DELETE, PATCH, HEAD, or OPTIONS route handler. |
| RestHandler | @"/path" fn h(x: RestExchange) -> void implements RestHandler | Bind a method-agnostic HTTP route handler. |
| CliCommand | @"cmd" fn h(x: RestExchange) -> void implements CliCommand | Bind a named CLI subcommand dispatched by rest_cli. |
| CliOption | @"--flag" fn h(x: RestExchange) -> void implements CliOption | Bind a CLI option flag (--flag=val or --flag val) evaluated before the command handler. |
| rest_config | rest_config(key: string, value: string) -> void | Configure server or CLI settings such as host, port, and session (ephemeral or global). |
| rest_route | rest_route(method: string, path: string, handler: string) -> void | Dynamically register an HTTP method and route pattern to a handler function name. |
| rest_serve / rest_stop | rest_serve() -> void | rest_stop() -> void | Start or stop the embedded standard HTTP server loop. |
| rest_cli | rest_cli(args: StrList) -> string | Dispatch CLI options, commands, or path requests in-process without opening a socket. |
| RestExchange | x.method() | x.path() | x.body() | x.param(string) | x.query(string) | x.header(string) -> string | Read request method, path, body, :param segment, query parameter, or header. |
| RestExchange | x.has_query(string) | x.has_header(string) -> bool | Check whether a query parameter or request header is present. |
| RestExchange | x.status(int) | x.set_header(string, string) | x.send(string) | x.json(string) -> void | Set response status code and headers, and emit plain text or application/json bodies. |
| RestExchange | x.get(string) -> string | x.set(string, string) -> void | x.increment(string) -> int | Read, write, or atomically increment session state keys across global or ephemeral exchanges. |
Exit codes
| Exit code | Phase / mode | Meaning |
|---|---|---|
| 0 | Success | Server exited cleanly, or _lmcode_ bytecode / schema / signature command completed and all assertions passed. |
| 2 | CLI usage (phase "cli") | Missing --lmcode <file> argument or invalid host CLI invocation (code CLI_USAGE). |
| 3 | Load / run error (phase "load" or "run") | Bytecode file missing or corrupt, schema hash mismatch, RESP command error reply, or failed runtime assertion. |