### Install RCProxy as a Systemd Service Source: https://context7.com/clia/rcproxy/llms.txt Steps to install RCProxy as a systemd service for production environments. This involves copying the binary, configuration, and service file, then enabling and starting the service. ```bash # Copy binary to system path sudo cp ./target/release/rcproxy /usr/local/bin/ # Create configuration directory sudo mkdir /etc/rcproxy sudo cp default.toml /etc/rcproxy/ # Create log directory sudo mkdir /var/log/rcproxy # Install and enable systemd service sudo cp service/systemd/rcproxy.service /lib/systemd/system/ sudo systemctl enable rcproxy sudo systemctl start rcproxy # Check service status sudo systemctl status rcproxy ``` -------------------------------- ### Rust RCProxy Library Usage Source: https://context7.com/clia/rcproxy/llms.txt Example of how to use the RCProxy functionality as a Rust library. It demonstrates adding the dependency in Cargo.toml and calling the `run` function to start the proxy. ```rust // Cargo.toml // [dependencies] // libaster = { path = "path/to/rcproxy" } use libaster; fn main() { // Run the proxy with CLI argument parsing // This reads configuration from command line arguments if let Err(e) = libaster::run() { eprintln!("Failed to start proxy: {}", e); std::process::exit(1); } } ``` -------------------------------- ### Install RCProxy System Files Source: https://github.com/clia/rcproxy/blob/main/README.md Installs RCProxy to system directories, copies the default configuration, creates a log directory, and sets up a systemd service for managing the proxy. This requires root privileges. ```bash sudo cp ./target/release/rcproxy /usr/local/bin/ sudo mkdir /etc/rcproxy sudo cp default.toml /etc/rcproxy/ sudo mkdir /var/log/rcproxy sudo cp service/systemd/rcproxy.service /lib/systemd/system/ sudo systemctl enable rcproxy sudo systemctl start rcproxy ``` -------------------------------- ### Rust HTTP Server with Actix-HTTP Source: https://github.com/clia/rcproxy/blob/main/vendor/actix-http/README.md This Rust code snippet demonstrates how to set up a basic HTTP server using the actix-http crate. It binds to a specified address and port, handles incoming requests, and sends a 'Hello world!' response. Dependencies include `actix_http`, `Server`, `IntoFramed`, `h1::Codec`, `ServiceConfig`, `TakeItem`, and `SendResponse`. ```rust extern crate actix_http; use actix_http::{h1, Response, ServiceConfig}; fn main() { Server::new().bind("framed_hello", "127.0.0.1:8080", || { IntoFramed::new(|| h1::Codec::new(ServiceConfig::default())) // <- create h1 codec .and_then(TakeItem::new().map_err(|_| ())) // <- read one request .and_then(|(_req, _framed): (_, Framed<_, _>)| { // <- send response and close conn SendResponse::send(_framed, Response::Ok().body("Hello world!")) .map_err(|_| ()) .map(|_| ()) }) }).unwrap().run(); } ``` -------------------------------- ### RCProxy Supported Redis Read Commands (Bash) Source: https://context7.com/clia/rcproxy/llms.txt Example commands to interact with RCProxy using redis-cli, demonstrating support for various Redis read operations like GET, MGET, HGETALL, LRANGE, and SMEMBERS. ```bash # Connect to RCProxy redis-cli -h localhost -p 6379 # String operations GET mykey MGET key1 key2 key3 STRLEN mykey GETRANGE mykey 0 10 # Hash operations HGET myhash field HGETALL myhash HMGET myhash field1 field2 HKEYS myhash HVALS myhash HLEN myhash # List operations LINDEX mylist 0 LLEN mylist LRANGE mylist 0 -1 # Set operations SCARD myset SISMEMBER myset member SMEMBERS myset SRANDMEMBER myset 5 ``` -------------------------------- ### RCProxy TOML Configuration Example Source: https://github.com/clia/rcproxy/blob/main/README.md A sample TOML configuration file for RCProxy, demonstrating settings for logging, metrics, and cluster definitions. This file dictates the proxy's behavior, including network interfaces, backend servers, and operational parameters. ```toml [log] level = "libaster=info" # "trace" "debug" "info" "warn" "error" ansi = true # support ANSI colors stdout = false # print logs to stdout, not to log files directory = "/var/log/rcproxy" # log file directory file_name = "rcproxy.log" # log file name [metrics] # change port config, to run multiple instance in one machine. port = 2110 [[clusters]] # name of the cluster. Each cluster means one front-end port. name="test-redis-cluster" # listen_addr means the cluster front end server address. listen_addr="0.0.0.0:9001" # cache_type only support memcache|redis|redis_cluster cache_type="redis_cluster" # servers means cache backend. support two format: # for cache_type is memcache or redis, you can set it as: # # servers = [ # "127.0.0.1:7001:10 redis-1", # "127.0.0.1:7002:10 redis-2", # "127.0.0.1:7003:10 redis-3"] # # as you can see, the format is consisted with: # # "${addr}:hash_weight ${node_alias}" # # And, for redis_cluster you can set the item as: # # servers = ["127.0.0.1:7000", "127.0.0.1:7001"] # # which means the seed nodes to connect to redis cluster. servers = ["127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003", "127.0.0.1:7004", "127.0.0.1:7005"] # Work thread number, it's suggested as the number of your cpu(hyper-thread) number. thread = 1 # ReadTimeout is the socket read timeout which effects all in the socket in millisecond read_timeout = 2000 # WriteTimeout is the socket write timeout which effects all in the socket in millisecond write_timeout = 2000 ############################# Cluster Mode Special ####################################################### # fetch means fetch interval for backend cluster to keep cluster info become newer. # default 10 * 60 seconds fetch = 600 # read_from_slave is the feature make slave balanced readed by client and ignore side effects. read_from_slave = true ############################# Proxy Mode Special ####################################################### # ping_fail_limit means when ping fail reach the limit number, the node will be ejected from the cluster # until the ping is ok in future. # if ping_fali_limit == 0, means that close the ping eject feature. ping_fail_limit=3 # ping_interval means the interval of each ping was send into backend node in millisecond. ping_interval=10000 # Configure password for backend server. It will send this password to backend server on connect. # Empty value will be ignored. auth = "" # mypassw ``` -------------------------------- ### Manage Docker Compose Deployment (Bash) Source: https://context7.com/clia/rcproxy/llms.txt Bash commands to manage the RCProxy deployment using Docker Compose. Includes starting the services in detached mode, viewing logs, and checking the status of running containers. ```bash # Start the deployment docker-compose up -d # View logs docker-compose logs -f rcproxy # Check health status docker-compose ps ``` -------------------------------- ### RCProxy Standalone Proxy Mode Configuration (TOML) Source: https://context7.com/clia/rcproxy/llms.txt Example TOML configuration for RCProxy in standalone proxy mode, compatible with Twemproxy. It enables consistent-hash sharding across multiple Redis instances and includes health check settings. ```toml # standalone-proxy.toml - Twemproxy-compatible Configuration [log] level = "libaster=info" ansi = true stdout = true directory = "/var/log/rcproxy" file_name = "rcproxy.log" [metrics] port = 2110 [[clusters]] name = "sharded-redis" listen_addr = "0.0.0.0:6379" cache_type = "redis" # Standalone Redis sharding mode hash_tag = "{}" # Server format: "host:port:weight alias" servers = [ "192.168.1.10:6379:100 redis-shard-1", "192.168.1.11:6379:100 redis-shard-2", "192.168.1.12:6379:100 redis-shard-3", "192.168.1.13:6379:50 redis-shard-4" # Lower weight = fewer keys ] thread = 4 read_timeout = 1000 write_timeout = 1000 # Health check settings for automatic node ejection ping_fail_limit = 3 # Eject node after 3 consecutive ping failures ping_interval = 10000 # Ping interval in milliseconds auth = "" ``` -------------------------------- ### Build RCProxy using Cargo Source: https://github.com/clia/rcproxy/blob/main/README.md This command compiles the RCProxy project in release mode, producing an optimized executable. It requires the Rust toolchain and Cargo to be installed. ```bash cargo build --all --release ``` -------------------------------- ### Redis Hash Operations Source: https://context7.com/clia/rcproxy/llms.txt Commands for managing hash data structures in Redis. Allows setting and getting field-value pairs, incrementing integer values of fields, and deleting fields. ```redis HSET myhash field value HMSET myhash f1 v1 f2 v2 HINCRBY myhash field 1 HDEL myhash field ``` -------------------------------- ### Run RCProxy with Configuration Files Source: https://context7.com/clia/rcproxy/llms.txt Demonstrates how to execute the RCProxy binary with a TOML configuration file. Includes options for specifying custom IP exposure for cluster discovery and enabling hot-reloading for standalone proxy mode. ```bash # Run with default configuration ./target/release/rcproxy default.toml # Run with custom IP exposure for cluster discovery ./target/release/rcproxy default.toml --ip 192.168.1.100 # Run with hot-reload enabled for standalone proxy mode ./target/release/rcproxy default.toml --reload ``` -------------------------------- ### Build Docker Image for RCProxy (Bash) Source: https://context7.com/clia/rcproxy/llms.txt Instructions to build the Docker image for RCProxy. It includes using a provided script or manual docker build commands. The multi-stage build aims for a minimal runtime footprint. ```bash # Build using the provided script ./docker-build.sh # Or build manually with specific tags docker build -t clia/rcproxy:2.2.2 . docker build -t clia/rcproxy:latest . # Verify image size (expect ~100-200MB with multi-stage build) docker images clia/rcproxy ``` -------------------------------- ### Build RCProxy from Source using Cargo Source: https://context7.com/clia/rcproxy/llms.txt Instructions to clone the RCProxy repository and build the project using Cargo with release optimizations for production. The resulting binary is located in the target/release directory. ```bash # Clone the repository git clone https://github.com/clia/rcproxy.git cd rcproxy # Build with release optimizations cargo build --all --release # The binary will be at ./target/release/rcproxy ``` -------------------------------- ### Run RCProxy with Configuration Source: https://github.com/clia/rcproxy/blob/main/README.md Executes the compiled RCProxy binary, specifying a TOML configuration file. Ensure the configuration file is correctly formatted and accessible. ```bash ./target/release/rcproxy default.toml ``` -------------------------------- ### Run RCProxy Container with Docker (Bash) Source: https://context7.com/clia/rcproxy/llms.txt Commands to run the RCProxy container using Docker. Options include basic deployment, custom configuration with volume mounts for config and logs, and host networking for performance. ```bash # Basic run docker run -d \ --name rcproxy \ -p 6379:6379 \ -p 2110:2110 \ clia/rcproxy:latest # Run with custom configuration and log volume docker run -d \ --name rcproxy \ -p 6379:6379 \ -p 2110:2110 \ -v /path/to/config.toml:/configs/default/default.toml \ -v /var/log/rcproxy:/app/logs \ --memory="1g" \ --cpus="2" \ --restart unless-stopped \ clia/rcproxy:latest # Run with host networking for maximum performance (Linux only) docker run -d \ --name rcproxy \ --network host \ -v /path/to/config.toml:/configs/default/default.toml \ clia/rcproxy:latest ``` -------------------------------- ### Select Database Source: https://context7.com/clia/rcproxy/llms.txt Selects the database to use (only DB 0 is supported). ```APIDOC ## POST /clia/rcproxy ### Description Selects the database to use. Only database 0 is supported in cluster mode. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "SELECT", "db": 0 } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - Must be "SELECT". - **db** (integer) - Required - The database index to select (must be 0). ### Response #### Success Response (200) - **result** (string) - "OK" if the database is selected successfully. #### Response Example ```json { "result": "OK" } ``` ``` -------------------------------- ### Rust Library Usage Source: https://context7.com/clia/rcproxy/llms.txt How to use RCProxy as a Rust library. ```APIDOC ## Library Usage (Rust) ### Using libaster as a Library RCProxy can be used as a Rust library for embedding proxy functionality. **Cargo.toml** ```toml [dependencies] libaster = { path = "path/to/rcproxy" } ``` **main.rs** ```rust use libaster; fn main() { // Run the proxy with CLI argument parsing // This reads configuration from command line arguments if let Err(e) = libaster::run() { eprintln!("Failed to start proxy: {}", e); std::process::exit(1); } } ``` ``` -------------------------------- ### Deploy RCProxy with Docker Compose (YAML) Source: https://context7.com/clia/rcproxy/llms.txt Docker Compose configuration for deploying RCProxy. It defines the service, image, ports, volumes for configuration and logs, restart policy, health checks, resource limits, and networking. ```yaml version: '3.8' services: rcproxy: image: clia/rcproxy:latest container_name: rcproxy ports: - "6379:6379" # Redis proxy port - "2110:2110" # Prometheus metrics port volumes: - ./config.toml:/configs/default/default.toml - ./logs:/app/logs restart: unless-stopped healthcheck: test: ["CMD", "redis-cli", "-p", "6379", "ping"] interval: 30s timeout: 10s retries: 3 start_period: 40s deploy: resources: limits: memory: 1G cpus: '2' networks: - redis-network networks: redis-network: driver: bridge ``` -------------------------------- ### Environment Variables Source: https://context7.com/clia/rcproxy/llms.txt Environment variables for configuring RCProxy. ```APIDOC ## Environment Variables Configure RCProxy behavior through environment variables. **Example Usage** ```bash # Set default worker thread count (used when not specified in config) export ASTER_DEFAULT_THREAD=8 # Set Rust logging level export RUST_LOG=info # Run the proxy ./rcproxy config.toml ``` ### Environment Variables - **ASTER_DEFAULT_THREAD** (integer): Sets the default worker thread count. Defaults to the number of available CPU cores if not specified. - **RUST_LOG** (string): Sets the Rust logging level (e.g., `error`, `warn`, `info`, `debug`, `trace`). ``` -------------------------------- ### Key Operations (Read) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform read operations on keys. ```APIDOC ## GET /clia/rcproxy ### Description Provides read operations for keys. ### Method GET ### Endpoint /clia/rcproxy ### Query Parameters - **command** (string) - Required - The key operation command to execute (e.g., TTL, PTTL, TYPE, EXISTS, DUMP). - **key** (string) - Required - The key to operate on. - **keys** (string) - Optional - Multiple keys for commands like EXISTS. ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": 3600 } ``` ``` -------------------------------- ### Memcache Proxy Configuration (TOML) Source: https://context7.com/clia/rcproxy/llms.txt Configuration file for RCProxy to manage memcache clusters. It defines logging, metrics, and cluster settings including listen addresses, cache type, server list, and timeouts. ```toml [log] level = "libaster=info" ansi = true stdout = true directory = "/var/log/rcproxy" file_name = "rcproxy.log" [metrics] port = 2111 [[clusters]] name = "memcache-cluster" listen_addr = "0.0.0.0:11211" cache_type = "memcache" # Use "memcache_binary" for binary protocol servers = [ "192.168.1.20:11211:100 mc-node-1", "192.168.1.21:11211:100 mc-node-2" ] thread = 2 read_timeout = 1000 write_timeout = 1000 ping_fail_limit = 3 ping_interval = 10000 ``` -------------------------------- ### Key Operations (Write) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform write operations on keys. ```APIDOC ## POST /clia/rcproxy ### Description Performs write operations on keys. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "DEL", "keys": ["key1", "key2"] } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - The key operation command to execute (e.g., DEL, UNLINK, EXPIRE, EXPIREAT, PERSIST). - **key** (string) - Required for commands operating on a single key. - **keys** (array) - Required for commands operating on multiple keys (e.g., DEL, UNLINK). An array of key names. - **seconds** (integer) - Required for EXPIRE. The time in seconds until the key expires. - **timestamp** (integer) - Required for EXPIREAT. The Unix timestamp when the key expires. ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": 2 } ``` ``` -------------------------------- ### RCProxy Environment Variable Configuration Source: https://context7.com/clia/rcproxy/llms.txt Demonstrates setting environment variables to configure RCProxy behavior. Variables like ASTER_DEFAULT_THREAD control worker threads, and RUST_LOG sets the logging level. ```bash # Set default worker thread count (used when not specified in config) export ASTER_DEFAULT_THREAD=8 # Set Rust logging level export RUST_LOG=info # Run the proxy ./rcproxy config.toml ``` -------------------------------- ### Scripting (EVAL) Source: https://context7.com/clia/rcproxy/llms.txt Executes Lua scripts on the Redis server. ```APIDOC ## POST /clia/rcproxy ### Description Executes Lua scripts on the Redis server with key constraints. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "EVAL", "script": "return redis.call('GET', KEYS[1])", "numkeys": 1, "keys": ["mykey"], "args": [] } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - Must be "EVAL". - **script** (string) - Required - The Lua script to execute. - **numkeys** (integer) - Required - The number of keys that the script will receive as arguments. - **keys** (array) - Required - An array of key names passed to the script. - **args** (array) - Optional - An array of additional arguments passed to the script. ### Response #### Success Response (200) - **result** (any) - The result returned by the Lua script. #### Response Example ```json { "result": "some_value" } ``` ``` -------------------------------- ### Sorted Set Operations (Read) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform read operations on sorted sets. ```APIDOC ## GET /clia/rcproxy ### Description Provides read operations for sorted sets. ### Method GET ### Endpoint /clia/rcproxy ### Query Parameters - **command** (string) - Required - The sorted set command to execute (e.g., ZCARD, ZCOUNT, ZRANGE, ZRANGEBYSCORE, ZRANK, ZSCORE). - **key** (string) - Required - The key of the sorted set. - **args** (string) - Optional - Additional arguments for the command (e.g., min/max scores for ZRANGEBYSCORE, member for ZRANK/ZSCORE). ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": [ "member1", "member2" ] } ``` ``` -------------------------------- ### RCProxy Memcache Protocol Configuration (TOML) Source: https://context7.com/clia/rcproxy/llms.txt Placeholder for RCProxy configuration when using the Memcache protocol. This section would detail specific settings for Memcache proxying. ```toml # Memcache Protocol Configuration # Configuration details for Memcache protocol would go here. ``` -------------------------------- ### Cluster Information Commands Source: https://context7.com/clia/rcproxy/llms.txt Retrieves information about the Redis cluster. ```APIDOC ## GET /clia/rcproxy ### Description Retrieves information about the Redis cluster configuration. ### Method GET ### Endpoint /clia/rcproxy ### Query Parameters - **command** (string) - Required - Either "CLUSTER SLOTS" or "CLUSTER NODES". ### Response #### Success Response (200) - **result** (any) - The cluster information returned by the command. #### Response Example ```json { "result": [ { "start_slot": 0, "end_slot": 16383, "master": "127.0.0.1:7000", "replicas": [] } ] } ``` ``` -------------------------------- ### Fetch RCProxy Metrics (Bash) Source: https://context7.com/clia/rcproxy/llms.txt Bash command to fetch Prometheus-compatible metrics exposed by RCProxy. The metrics endpoint provides insights into proxy version, connections, CPU/memory usage, and command timers. ```bash # Fetch metrics from the proxy curl http://localhost:2110/metrics # Example output: # HELP aster_version aster current running version # TYPE aster_version gauge # aster_version{version="2.2.2"} 1 # HELP aster_front_connection each front nodes connections gauge # TYPE aster_front_connection gauge # aster_front_connection{cluster="production-redis-cluster"} 42 # HELP aster_front_connection_incr each front nodes connections gauge # TYPE aster_front_connection_incr counter # aster_front_connection_incr{cluster="production-redis-cluster"} 1523 # HELP aster_cpu_usage aster current cpu usage # TYPE aster_cpu_usage gauge # aster_cpu_usage 12.5 # HELP aster_memory_usage aster current memory usage # TYPE aster_memory_usage gauge # aster_memory_usage 52428800 # HELP aster_thread_count aster thread count counter # TYPE aster_thread_count counter # aster_thread_count 6 # HELP aster_global_error aster global error counter # TYPE aster_global_error counter # aster_global_error 0 # HELP aster_total_timer set up each cluster command proxy total timer # TYPE aster_total_timer histogram # aster_total_timer_bucket{cluster="production-redis-cluster",le="1000"} 15234 # HELP aster_remote_timer set up each cluster command proxy remote timer # TYPE aster_remote_timer histogram # aster_remote_timer_bucket{cluster="production-redis-cluster",le="1000"} 15234 ``` -------------------------------- ### Sorted Set Operations (Write) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform write operations on sorted sets. ```APIDOC ## POST /clia/rcproxy ### Description Performs write operations on sorted set keys. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "ZADD", "key": "myzset", "members": [{"score": 1, "member": "member1"}, {"score": 2, "member": "member2"}] } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - The sorted set command to execute (e.g., ZADD, ZINCRBY, ZREM). - **key** (string) - Required - The sorted set key. - **members** (array) - Required for ZADD. An array of objects, each with a "score" (number) and "member" (string). - **score** (number) - Required for ZINCRBY. The score to increment by. - **member** (string) - Required for ZINCRBY, ZREM. The member to operate on. ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": 1 } ``` ``` -------------------------------- ### Prometheus Scrape Configuration (YAML) Source: https://context7.com/clia/rcproxy/llms.txt Prometheus configuration file to scrape metrics from RCProxy. It defines the job name, targets, scrape interval, and the metrics path. ```yaml # prometheus.yml scrape_configs: - job_name: 'rcproxy' static_configs: - targets: ['rcproxy:2110'] scrape_interval: 15s metrics_path: /metrics ``` -------------------------------- ### Hash Operations (Write) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform write operations on hashes. ```APIDOC ## POST /clia/rcproxy ### Description Performs write operations on hash keys. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "HSET", "key": "myhash", "field": "field", "value": "value" } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - The hash command to execute (e.g., HSET, HMSET, HINCRBY, HDEL). - **key** (string) - Required - The hash key. - **field** (string) - Required - The field within the hash. - **value** (string) - Required for HSET, HMSET. The value to set. - **fields** (object) - Required for HMSET. An object mapping fields to values. - **increment** (integer) - Required for HINCRBY. The amount to increment by. ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": 1 } ``` ``` -------------------------------- ### Redis Key Operations Source: https://context7.com/clia/rcproxy/llms.txt Commands for managing Redis keys, including checking their time-to-live (TTL, PTTL), determining their type, checking for existence, and dumping their value. ```redis TTL mykey PTTL mykey TYPE mykey EXISTS key1 key2 key3 DUMP mykey ``` -------------------------------- ### Authentication Source: https://context7.com/clia/rcproxy/llms.txt Authenticates with the Redis server. ```APIDOC ## POST /clia/rcproxy ### Description Authenticates with the Redis server using a password. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "AUTH", "password": "your_password" } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - Must be "AUTH". - **password** (string) - Required - The password for authentication. ### Response #### Success Response (200) - **result** (string) - "OK" if authentication is successful. #### Response Example ```json { "result": "OK" } ``` ``` -------------------------------- ### String Operations (Write) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform write operations on strings. ```APIDOC ## POST /clia/rcproxy ### Description Performs write operations on string keys. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "SET", "key": "mykey", "value": "value" } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - The string command to execute (e.g., SET, SETEX, SETNX, MSET, INCR, INCRBY, DECR, APPEND). - **key** (string) - Required - The key for the string operation. - **value** (string) - Required for commands like SET, APPEND. The value to set or append. - **keys** (object) - Required for MSET. An object mapping keys to values. - **field** (string) - Required for INCR/DECR commands. The field to increment or decrement. - **increment** (integer) - Optional for INCRBY/DECR. The amount to increment or decrement by. ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": "OK" } ``` ``` -------------------------------- ### Set Operations (Write) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform write operations on sets. ```APIDOC ## POST /clia/rcproxy ### Description Performs write operations on set keys. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "SADD", "key": "myset", "members": ["member1", "member2"] } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - The set command to execute (e.g., SADD, SREM, SPOP). - **key** (string) - Required - The set key. - **members** (array) - Required for SADD, SREM. An array of members to add or remove. ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": 2 } ``` ``` -------------------------------- ### Redis Cluster Information and Database Selection Source: https://context7.com/clia/rcproxy/llms.txt Commands to retrieve information about the Redis cluster topology and to select the database. In cluster mode, only database 0 is supported. ```redis SELECT 0 CLUSTER SLOTS CLUSTER NODES ``` -------------------------------- ### List Operations (Write) Source: https://context7.com/clia/rcproxy/llms.txt These commands perform write operations on lists. ```APIDOC ## POST /clia/rcproxy ### Description Performs write operations on list keys. ### Method POST ### Endpoint /clia/rcproxy ### Request Body ```json { "command": "LPUSH", "key": "mylist", "value": "value" } ``` ### Parameters #### Request Body Fields - **command** (string) - Required - The list command to execute (e.g., LPUSH, RPUSH, LPOP, RPOP, LSET, LTRIM). - **key** (string) - Required - The list key. - **value** (string) - Required for LPUSH, RPUSH, LSET. The value to add or set. - **index** (integer) - Required for LSET. The index to set the value at. ### Response #### Success Response (200) - **result** (any) - The result of the executed command. #### Response Example ```json { "result": 3 } ``` ``` -------------------------------- ### Redis Scripting with EVAL Source: https://context7.com/clia/rcproxy/llms.txt Executes a Lua script on the Redis server. The EVAL command supports accessing keys specified in KEYS array, enabling custom logic execution. ```redis EVAL "return redis.call('GET', KEYS[1])" 1 mykey ``` -------------------------------- ### Redis String Operations Source: https://context7.com/clia/rcproxy/llms.txt Basic commands for manipulating string values in Redis. Includes setting values, setting with expiration, setting if not exists, setting multiple keys, and incrementing/decrementing numeric values. ```redis SET mykey "value" SETEX mykey 3600 "value" SETNX mykey "value" MSET key1 "v1" key2 "v2" INCR counter INCRBY counter 10 DECR counter APPEND mykey " appended" ``` -------------------------------- ### Redis Key Write Operations Source: https://context7.com/clia/rcproxy/llms.txt Commands for deleting, unlinking, setting expiration times, and persisting Redis keys. These operations manage the lifecycle and persistence of keys. ```redis DEL key1 key2 UNLINK key1 key2 EXPIRE mykey 3600 EXPIREAT mykey 1893456000 PERSIST mykey ``` -------------------------------- ### Redis Sorted Set Write Operations Source: https://context7.com/clia/rcproxy/llms.txt Commands for adding, updating, and removing elements in Redis sorted sets. Includes adding members with scores, incrementing scores, and removing members. ```redis ZADD myzset 1 member1 2 member2 ZINCRBY myzset 1 member1 ZREM myzset member1 ``` -------------------------------- ### Ping/Echo Source: https://context7.com/clia/rcproxy/llms.txt Performs health checks. ```APIDOC ## GET /clia/rcproxy ### Description Performs health checks using PING or ECHO. ### Method GET ### Endpoint /clia/rcproxy ### Query Parameters - **command** (string) - Required - Either "PING" or "ECHO". - **message** (string) - Required for ECHO command. The message to echo back. ### Response #### Success Response (200) - **result** (any) - The response from the PING or ECHO command. #### Response Example ```json { "result": "PONG" } ``` ```json { "result": "hello" } ``` ``` -------------------------------- ### Redis Sorted Set Operations Source: https://context7.com/clia/rcproxy/llms.txt Commands for interacting with Redis sorted sets. These operations allow for retrieving the number of elements, elements within a score range, and the rank or score of a specific member. ```redis ZCARD myzset ZCOUNT myzset 0 100 ZRANGE myzset 0 -1 ZRANGEBYSCORE myzset 0 100 ZRANK myzset member ZSCORE myzset member ``` -------------------------------- ### Redis Set Operations Source: https://context7.com/clia/rcproxy/llms.txt Commands for managing set data structures in Redis. Allows adding members, removing members, and popping a random member from the set. ```redis SADD myset member1 member2 SREM myset member1 SPOP myset ``` -------------------------------- ### Redis List Operations Source: https://context7.com/clia/rcproxy/llms.txt Commands for manipulating list data structures in Redis. Supports pushing and popping elements from both ends of the list, and trimming the list to a specified range. ```redis LPUSH mylist value RPUSH mylist value LPOP mylist RPOP mylist LSET mylist 0 "newvalue" LTRIM mylist 0 99 ``` -------------------------------- ### Redis Authentication and Health Checks Source: https://context7.com/clia/rcproxy/llms.txt Commands for authenticating with the Redis server and performing health checks. AUTH is required if authentication is configured, while PING and ECHO are used for connectivity tests. ```redis AUTH password PING ECHO "hello" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.