.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "VMOD_REDIS" 3 "" "" "" .SH NAME vmod_redis \- Redis VMOD .\" . .\" NB: This file is machine generated, DO NOT EDIT! . .\" . .\" Edit ./vmod_redis.vcc and run make instead . .\" . .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import redis [as name] [from "path"] VOID subnets(STRING masks) VOID sentinels(STRING locations, INT period, INT connection_timeout, INT command_timeout, ENUM protocol, BOOL tls, STRING tls_cafile, STRING tls_capath, STRING tls_certfile, STRING tls_keyfile, STRING tls_sni, STRING password) VOID use(STRING db) VOID add_server(STRING location, ENUM type, STRING db) VOID command(STRING name, STRING db) VOID timeout(INT command_timeout, STRING db) VOID retries(INT max_command_retries, STRING db) VOID push(STRING arg, STRING db) VOID execute(BOOL master, STRING db) BOOL replied(STRING db) BOOL reply_is_error(STRING db) BOOL reply_is_nil(STRING db) BOOL reply_is_status(STRING db) BOOL reply_is_integer(STRING db) BOOL reply_is_boolean(STRING db) BOOL reply_is_double(STRING db) BOOL reply_is_string(STRING db) BOOL reply_is_array(STRING db) STRING get_reply(STRING db) STRING get_error_reply(STRING db) STRING get_status_reply(STRING db) INT get_integer_reply(STRING db) BOOL get_boolean_reply(STRING db) REAL get_double_reply(STRING db) STRING get_string_reply(STRING db) INT get_array_reply_length(STRING db) BOOL array_reply_is_error(INT index, STRING db) BOOL array_reply_is_nil(INT index, STRING db) BOOL array_reply_is_status(INT index, STRING db) BOOL array_reply_is_integer(INT index, STRING db) BOOL array_reply_is_boolean(INT index, STRING db) BOOL array_reply_is_double(INT index, STRING db) BOOL array_reply_is_string(INT index, STRING db) BOOL array_reply_is_array(INT index, STRING db) STRING get_array_reply_value(INT index, STRING db) VOID free(STRING db) STRING stats(ENUM format, BOOL stream, STRING prometheus_name_prefix, BOOL prometheus_default_labels, STRING prometheus_extra_labels, STRING db) INT counter(STRING name, STRING db) new xdb = redis.db(STRING location, ENUM type, INT connection_timeout, INT connection_ttl, INT command_timeout, INT max_command_retries, BOOL shared_connections, INT max_connections, ENUM protocol, BOOL tls, STRING tls_cafile, STRING tls_capath, STRING tls_certfile, STRING tls_keyfile, STRING tls_sni, STRING user, STRING password, INT sickness_ttl, BOOL ignore_slaves, INT max_cluster_hops) VOID xdb.add_server(STRING location, ENUM type) VOID xdb.command(STRING name) VOID xdb.timeout(INT command_timeout) VOID xdb.retries(INT max_command_retries) VOID xdb.push(STRING arg) VOID xdb.execute(BOOL master) BOOL xdb.replied() BOOL xdb.reply_is_error() BOOL xdb.reply_is_nil() BOOL xdb.reply_is_status() BOOL xdb.reply_is_integer() BOOL xdb.reply_is_boolean() BOOL xdb.reply_is_double() BOOL xdb.reply_is_string() BOOL xdb.reply_is_array() STRING xdb.get_reply() STRING xdb.get_error_reply() STRING xdb.get_status_reply() INT xdb.get_integer_reply() BOOL xdb.get_boolean_reply() REAL xdb.get_double_reply() STRING xdb.get_string_reply() INT xdb.get_array_reply_length() BOOL xdb.array_reply_is_error(INT index) BOOL xdb.array_reply_is_nil(INT index) BOOL xdb.array_reply_is_status(INT index) BOOL xdb.array_reply_is_integer(INT index) BOOL xdb.array_reply_is_boolean(INT index) BOOL xdb.array_reply_is_double(INT index) BOOL xdb.array_reply_is_string(INT index) BOOL xdb.array_reply_is_array(INT index) STRING xdb.get_array_reply_value(INT index) VOID xdb.free() STRING xdb.stats(ENUM format, BOOL stream, STRING prometheus_name_prefix, BOOL prometheus_default_labels, STRING prometheus_extra_labels) INT xdb.counter(STRING name) .ft P .fi .UNINDENT .UNINDENT .SH DESCRIPTION .sp VMOD using the synchronous hiredis library API to access Redis servers from VCL. .SS VOID subnets(STRING masks="") .INDENT 0.0 .TP .B Arguments .INDENT 7.0 .TP .B subnets: Comma\-delimited list of weights + subnet masks used to select among servers associated to a database instance when executing commands. Order is relevant. Only IPv4 addresses are supported. If not provided, value in the VMOD_REDIS_SUBNETS environment variable will be used. .sp This is useful in setups using Redis instances deployed across multiple data centers or availability zones. .UNINDENT .TP .B Description Using this function is not mandatory. If used, it must be called during \fBvcl_init\fP before creating any database instance. If a database instance has already been created calls to this function are silently ignored. .UNINDENT .SS VOID sentinels(STRING locations, INT period, INT connection_timeout, INT command_timeout, ENUM protocol, BOOL tls, STRING tls_cafile, STRING tls_capath, STRING tls_certfile, STRING tls_keyfile, STRING tls_sni, STRING password) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C VOID sentinels( STRING locations="", INT period=60, INT connection_timeout=500, INT command_timeout=0, ENUM {RESP2, RESP3, default} protocol=default, BOOL tls=0, STRING tls_cafile="", STRING tls_capath="", STRING tls_certfile="", STRING tls_keyfile="", STRING tls_sni="", STRING password="" ) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B Arguments .INDENT 7.0 .TP .B locations: Comma\-delimited list of Redis Sentinel servers. Only host (IP or DNS name) + port format is allowed. If not provided, value in the VMOD_REDIS_SENTINELS environment variable will be used. .sp This is useful in setups using non\-clustered Redis instances in order to (1) keep roles (i.e. master / slave) updated; and (2) decrease priority of unreachable servers when creating execution plans. This is \fBnot\fP designed for auto\-discovery of Redis Servers. .UNINDENT .sp period: how frequently (seconds) Redis Sentinel periodical checks are executed (0 means disabling periodical checks). Beware (1) proactive checks are also executed anytime the VCL state is changed to warm; and (2) Sentinel Pub/Sub events are listened and processed even when periodical checks are disabled. .sp connection_timeout: connection timeout (milliseconds; 0 means no timeout) to the Redis Sentinel servers. .sp command_timeout: command timeout (milliseconds; 0 means no timeout) when executing Redis Sentinel commands. .sp protocol: protocol to be used when talking to Redis Sentinel servers. Beware switching from \fBRESP2\fP to \fBRESP3\fP is only possible since Redis 6.0 and it uses an additional \fBHELLO\fP command when creating new Redis Sentinel connections. Be careful \fBRESP3\fP support is only available since \fBhiredis\fP 0.15.0. .sp tsl: if enabled, TLS will be used when establishing connections. .sp tls_cafile: if not empty, this CA certificate file will be used to verify TLS connections. .sp tls_capath: if not empty, this will be the directory storing trusted CA certificates used to verify TLS connections. If neither \fBtls_cafile\fP nor \fBtls_capath\fP are specified, the default system\-wide trusted root certs configuration will apply. .sp tls_certfile: if not empty, this certificate file will be used to authenticate TLS connections. .sp tls_keyfile: if not empty, this private key file will be used to authenticate TLS connections. .sp tls_sni: if not empty, this server name indication (i.e. SNI) will be used when establishing TLS connections. .sp password: if not empty, requests for authentication using the \fBAUTH\fP command will be submitted when creating new Redis Sentinel connections. This password will be used for all Redis Sentinel servers. .TP .B Description Using this function is not mandatory. .UNINDENT .SS VOID use(STRING db) .INDENT 0.0 .TP .B Arguments db: VCL name of the database instance. .TP .B Description Sets the current database instance to be used by proxied methods (if none is specified with their \fBdb\fP argument). .UNINDENT .SS VOID add_server(STRING location, ENUM type, STRING db) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C VOID add_server( STRING location, ENUM {master, slave, auto, cluster} type, STRING db="" ) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B Description Proxied version of \fB\&.add_server()\fP\&. .UNINDENT .SS VOID command(STRING name, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.command()\fP\&. .UNINDENT .SS VOID timeout(INT command_timeout, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.timeout()\fP\&. .UNINDENT .SS VOID retries(INT max_command_retries, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.retries()\fP\&. .UNINDENT .SS VOID push(STRING arg, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.push()\fP\&. .UNINDENT .SS VOID execute(BOOL master=1, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.execute()\fP\&. .UNINDENT .SS BOOL replied(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.replied()\fP\&. .UNINDENT .SS BOOL reply_is_error(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_error()\fP\&. .UNINDENT .SS BOOL reply_is_nil(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_nil()\fP\&. .UNINDENT .SS BOOL reply_is_status(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_status()\fP\&. .UNINDENT .SS BOOL reply_is_integer(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_integer()\fP\&. .UNINDENT .SS BOOL reply_is_boolean(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_boolean()\fP\&. .UNINDENT .SS BOOL reply_is_double(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_double()\fP\&. .UNINDENT .SS BOOL reply_is_string(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_string()\fP\&. .UNINDENT .SS BOOL reply_is_array(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.reply_is_array()\fP\&. .UNINDENT .SS STRING get_reply(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_reply()\fP\&. .UNINDENT .SS STRING get_error_reply(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_error_reply()\fP\&. .UNINDENT .SS STRING get_status_reply(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_status_reply()\fP\&. .UNINDENT .SS INT get_integer_reply(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_integer_reply()\fP\&. .UNINDENT .SS BOOL get_boolean_reply(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_boolean_reply()\fP\&. .UNINDENT .SS REAL get_double_reply(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_double_reply()\fP\&. .UNINDENT .SS STRING get_string_reply(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_string_reply()\fP\&. .UNINDENT .SS INT get_array_reply_length(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_array_reply_length()\fP\&. .UNINDENT .SS BOOL array_reply_is_error(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_error()\fP\&. .UNINDENT .SS BOOL array_reply_is_nil(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_nil()\fP\&. .UNINDENT .SS BOOL array_reply_is_status(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_status()\fP\&. .UNINDENT .SS BOOL array_reply_is_integer(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_integer()\fP\&. .UNINDENT .SS BOOL array_reply_is_boolean(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_boolean()\fP\&. .UNINDENT .SS BOOL array_reply_is_double(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_double()\fP\&. .UNINDENT .SS BOOL array_reply_is_string(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_string()\fP\&. .UNINDENT .SS BOOL array_reply_is_array(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.array_reply_is_array()\fP\&. .UNINDENT .SS STRING get_array_reply_value(INT index, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.get_array_reply_value()\fP\&. .UNINDENT .SS VOID free(STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.free()\fP\&. .UNINDENT .SS STRING stats(ENUM format, BOOL stream, STRING prometheus_name_prefix, BOOL prometheus_default_labels, STRING prometheus_extra_labels, STRING db) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C STRING stats( ENUM {json, prometheus} format=json, BOOL stream=0, STRING prometheus_name_prefix="vmod_redis_", BOOL prometheus_default_labels=1, STRING prometheus_extra_labels="", STRING db="" ) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B Description Proxied version of \fB\&.stats()\fP\&. .UNINDENT .SS INT counter(STRING name, STRING db="") .INDENT 0.0 .TP .B Description Proxied version of \fB\&.counter()\fP\&. .UNINDENT .SS new xdb = redis.db(STRING location, ENUM type, INT connection_timeout, INT connection_ttl, INT command_timeout, INT max_command_retries, BOOL shared_connections, INT max_connections, ENUM protocol, BOOL tls, STRING tls_cafile, STRING tls_capath, STRING tls_certfile, STRING tls_keyfile, STRING tls_sni, STRING user, STRING password, INT sickness_ttl, BOOL ignore_slaves, INT max_cluster_hops) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C new xdb = redis.db( STRING location="", ENUM {master, slave, auto, cluster} type=auto, INT connection_timeout=1000, INT connection_ttl=0, INT command_timeout=0, INT max_command_retries=0, BOOL shared_connections=1, INT max_connections=128, ENUM {RESP2, RESP3, default} protocol=default, BOOL tls=0, STRING tls_cafile="", STRING tls_capath="", STRING tls_certfile="", STRING tls_keyfile="", STRING tls_sni="", STRING user="", STRING password="", INT sickness_ttl=60, BOOL ignore_slaves=0, INT max_cluster_hops=32 ) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B Arguments location: Redis connection string. Both host (IP or DNS name) + port and UNIX sockets are supported. Only the IP + port format is allowed when Redis Cluster support is enabled. \fBDo not use DNS names in combination with \(ga\(garedis.subnets()\(ga\(ga or \(ga\(garedis.sentinels()\(ga\(ga\fP\&. .sp type: type of the Redis server referenced by \fBlocation\fP: .INDENT 7.0 .IP \(bu 2 The \fBauto\fP value enables automatic discovery of the current role of the server on bootstrap time using the \fBROLE\fP command. .IP \(bu 2 The \fBcluster\fP value enables Redis Cluster support, automatically discovering other servers in the cluster and their roles on demand using the \fBCLUSTER SLOTS\fP command. .UNINDENT .sp connection_timeout: connection timeout (milliseconds; 0 means no timeout) to the Redis server. .sp connection_ttl: TTL (seconds) of Redis connections (0 means no TTL). Once the TTL of a connection is consumed, the module transparently reestablishes it. See "Client timeouts" in \fI\%http://redis.io/topics/clients\fP for extra information. .sp command_timeout: command timeout (milliseconds; 0 means no timeout) when executing a Redis command. It can be overridden during command execution with \fB\&.timeout()\fP\&. .sp max_command_retries: number of retries to be executed after a failed command execution. It can be overridden during command execution with \fB\&.retries()\fP\&. .sp shared_connections: if enabled, Redis connections are not local to Varnish worker threads, but shared by all threads using one or more pools. .INDENT 7.0 .TP .B max_connections: When \fBshared_connections\fP is enabled, the VMOD creates one pool of Redis connections per location and database instance. This option sets the maximum number of connections in each pool. All Varnish worker threads using the same database instance will share connections in these pools. Pools are not shared between database instances. .sp Note that when Redis Cluster support is enabled for a database, each server is the cluster is internally labeled by the VMOD with its location (IP + port). .sp When \fBshared_connections\fP is disabled, Redis connections are local to each Varnish worker thread. This option sets the maximum number of Redis connections per Varnish worker thread. Each thread keeps up to one connection per location and database instance. If more than one (database, location) pair is available, incrementing this limit allows recycling of Redis connections. .sp WARNING: when creating multiple database instances, always use the same value in all instances using private connections. Otherwise you may experience inconsistent behavior. .UNINDENT .sp protocol: protocol to be used when talking to Redis Server servers. Beware switching from \fBRESP2\fP to \fBRESP3\fP is only possible since Redis 6.0 and it affects to type conversion rules. Be careful \fBRESP3\fP support is only available since \fBhiredis\fP 0.15.0. .sp tsl: if enabled, TLS will be used when establishing connections. .sp tls_cafile: if not empty, this CA certificate file will be used to verify TLS connections. .sp tls_capath: if not empty, this will be the directory storing trusted CA certificates used to verify TLS connections. If neither \fBtls_cafile\fP nor \fBtls_capath\fP are specified, the default system\-wide trusted root certs configuration will apply. .sp tls_certfile: if not empty, this certificate file will be used to authenticate TLS connections. .sp tls_keyfile: if not empty, this private key file will be used to authenticate TLS connections. .sp tls_sni: if not empty, this server name indication (i.e. SNI) will be used when establishing TLS connections. .sp user: if not empty and a \fBpassword\fP is provided, requests for authentication using the \fBAUTH\fP or \fBHELLO\fP command will include both the user name and its password. That enables usage of the Redis ACL system, available since Redis 6.0. .sp password: if not empty, requests for authentication using the \fBAUTH\fP or \fBHELLO\fP command will be submitted when creating new Redis connections. This password will be used for all Redis servers, including discovered servers when Redis Cluster support is enabled. .sp sickness_ttl: TTL (seconds) of the sickness flag (0 means no sickness flags) associated to a Redis server. Once a server is flagged as sick and while the flag is not expired the module will lazily drop existing connections to that server and it will try to avoid it as much as possible when creating execution plans. This TTL is overridden when Redis Sentinel servers are configured and some Sentinel discovers an unreachable server. .sp ignore_slaves: if enabled, slave servers are not considered when executing commands. In other words, enabling this option implicitly forces \fBmaster == true\fP when using the \fB\&.execute()\fP method. .sp max_cluster_hops: maximum number of redirections (0 means no limit) when executing a command and Redis Cluster support has been enabled. .TP .B Description Creates a new database instance. .UNINDENT .SS VOID xdb.add_server(STRING location, ENUM type) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C VOID xdb.add_server( STRING location, ENUM {master, slave, auto, cluster} type ) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B Arguments location: Redis connection string. Both host (IP or DNS name) + port and UNIX sockets are supported. If Redis Cluster support has been enabled only the IP + port format is allowed. \fBDo not use DNS names in combination with \(ga\(garedis.subnets()\(ga\(ga or \(ga\(garedis.sentinels()\(ga\(ga\fP\&. .sp type: type of the Redis server referenced by \fBlocation\fP: .INDENT 7.0 .IP \(bu 2 The \fBauto\fP value enables automatic discovery of the current role of the server on bootstrap time using the \fBROLE\fP command. .IP \(bu 2 If Redis Cluster support has been enabled \fBcluster\fP is the only allowed value. .UNINDENT .TP .B Description Adds an extra Redis server. .sp If Redis Cluster support has been enabled other servers in the cluster and their roles are automatically discovered by the VMOD using the \fBCLUSTER SLOTS\fP command. In any case, knowing more cluster servers during startup increases the chances of discover the cluster topology if some server is failing. .UNINDENT .SS VOID xdb.command(STRING name) .INDENT 0.0 .TP .B Arguments name: name of the Redis command to be executed. .TP .B Description Enqueues a Redis command (only the name of the command) for further execution. Arguments should be enqueued separately calling one or more times to the \fB\&.push()\fP method. .sp On execution time, \fBEVAL\fP commands are internally replace by \fBEVALSHA\fP commands, which fallback to the original \fBEVAL\fP command if the Redis server returns a \fBNOSCRIPT\fP error (see \fI\%http://redis.io/commands/eval\fP). .UNINDENT .SS VOID xdb.timeout(INT command_timeout) .INDENT 0.0 .TP .B Arguments command_timeout: command timeout (milliseconds; 0 means no timeout) to be used when executing a specific Redis command. .TP .B Description Allows overriding the default command timeout provided when calling \fB\&.db()\fP\&. .UNINDENT .SS VOID xdb.retries(INT max_command_retries) .INDENT 0.0 .TP .B Arguments max_command_retries: number of retries to be executed after a failed command execution. .TP .B Description Allows overriding the default number of retries provided when calling \fB\&.db()\fP\&. .UNINDENT .SS VOID xdb.push(STRING arg) .INDENT 0.0 .TP .B Arguments arg: argument of a previously enqueued Redis command. .TP .B Description Provides an argument to a previously enqueued Redis command. .UNINDENT .SS VOID xdb.execute(BOOL master=1) .INDENT 0.0 .TP .B Arguments master: when enabled slave servers are not considered for execution. .TP .B Return value VOID .TP .B Description Executes a previously enqueued Redis command. .sp When more than one Redis server is available, the destination server is selected according with \fBmaster\fP and with the list of weights + subnet masks provided when calling \fBredis.subnets()\fP\&. .sp WARNING: allowing execution of commands in slave servers (i.e. \fBmaster == false\fP) must be carefully used: .INDENT 7.0 .IP \(bu 2 When Redis Cluster support is disabled, sending a read\-write command to a read\-only slave server will result in an error reply. .IP \(bu 2 It\(aqs safe to send read\-only LUA scripts using \fBEVAL\fP or \fBEVALSHA\fP commands to a read\-only slave server when Redis Cluster support is disabled. Being a read\-only slave server does not block writes in the script cache. .IP \(bu 2 When Redis Cluster support is enabled, sending a read\-write command to a slave server will result in a redirection to the right master server. This kind of redirections trigger an internal rediscovery of the cluster topology. The client side won\(aqt notice the redirection, but triggering such an expensive operation on every command is a \fBterrible idea\fP\&. .IP \(bu 2 \fBIt\(aqs not safe to send read\-only LUA scripts using \(ga\(gaEVAL\(ga\(ga or \(ga\(gaEVALSHA\(ga\(ga commands to a slave server when Redis Cluster support is enabled\fP\&. Redis Cluster handles \fBEVAL\fP and \fBEVALSHA1\fP command as write operations that must be redirected to a master server. Therefore, this would result on a rediscovery of the cluster topology on every command execution. The VMOD internally forces \fBmaster == true\fP when Redis Cluster support is enabled and \fBEVAL\fP or \fBEVALSHA\fP command are submitted in order to avoid this counterintuitive scenario. .UNINDENT .UNINDENT .SS BOOL xdb.replied() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command using \fB\&.execute()\fP returned any reply. Not returning a reply usually means a failed connection, a connection timeout, etc. .UNINDENT .SS BOOL xdb.reply_is_error() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command using \fB\&.execute()\fP returned an error reply. .UNINDENT .SS BOOL xdb.reply_is_nil() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command using \fB\&.execute()\fP returned a nil reply. .UNINDENT .SS BOOL xdb.reply_is_status() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command using \fB\&.execute()\fP returned a status reply. .UNINDENT .SS BOOL xdb.reply_is_integer() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command \fB\&.execute()\fP returned an integer reply. .UNINDENT .SS BOOL xdb.reply_is_boolean() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command \fB\&.execute()\fP returned an boolean reply. .UNINDENT .SS BOOL xdb.reply_is_double() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command \fB\&.execute()\fP returned an double reply. .UNINDENT .SS BOOL xdb.reply_is_string() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command \fB\&.execute()\fP returned a string or verbatim reply. .UNINDENT .SS BOOL xdb.reply_is_array() .INDENT 0.0 .TP .B Return value TRUE if a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply. .UNINDENT .SS STRING xdb.get_reply() .INDENT 0.0 .TP .B Return value A string representation of the reply of a previously executed Redis command using \fB\&.execute()\fP\&. .TP .B Description Do not use this function to access to array, map or set replies. .UNINDENT .SS STRING xdb.get_error_reply() .INDENT 0.0 .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an error reply, this function returns a string representation of that reply. .UNINDENT .SS STRING xdb.get_status_reply() .INDENT 0.0 .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned a status reply, this function returns a string representation of that reply. .UNINDENT .SS INT xdb.get_integer_reply() .INDENT 0.0 .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an integer reply, this function returns an integer representation of that reply. .UNINDENT .SS BOOL xdb.get_boolean_reply() .INDENT 0.0 .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an boolean reply, this function returns an boolean representation of that reply. .UNINDENT .SS REAL xdb.get_double_reply() .INDENT 0.0 .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an double reply, this function returns an double representation of that reply. .UNINDENT .SS STRING xdb.get_string_reply() .INDENT 0.0 .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned a string or verbatim reply, this function returns a string representation of that reply. .UNINDENT .SS INT xdb.get_array_reply_length() .INDENT 0.0 .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns the number of elements in that reply. .UNINDENT .SS BOOL xdb.array_reply_is_error(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is an error reply (nested responses are not supported). .UNINDENT .SS BOOL xdb.array_reply_is_nil(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is a nil reply (nested responses are not supported). .UNINDENT .SS BOOL xdb.array_reply_is_status(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is a status reply (nested responses are not supported). .UNINDENT .SS BOOL xdb.array_reply_is_integer(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is an integer reply (nested responses are not supported). .UNINDENT .SS BOOL xdb.array_reply_is_boolean(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is an boolean reply (nested responses are not supported). .UNINDENT .SS BOOL xdb.array_reply_is_double(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is an double reply (nested responses are not supported). .UNINDENT .SS BOOL xdb.array_reply_is_string(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is a string or verbatim reply (nested responses are not supported). .UNINDENT .SS BOOL xdb.array_reply_is_array(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns TRUE if the nth element in that reply is an array, map or set reply (nested responses are not supported). .UNINDENT .SS STRING xdb.get_array_reply_value(INT index) .INDENT 0.0 .TP .B Arguments index: index in the array reply. .TP .B Return value If a previously executed Redis command using \fB\&.execute()\fP returned an array, map or set reply, this function returns a string representation of the nth element in that reply (nested responses are not supported). .UNINDENT .SS VOID xdb.free() .INDENT 0.0 .TP .B Description Frees memory internally used by Redis commands an replies. It\(aqs recommended to use this function, but if not called this will be handled automatically during the next call to \fB\&.command()\fP using the same object. .UNINDENT .SS STRING xdb.stats(ENUM format, BOOL stream, STRING prometheus_name_prefix, BOOL prometheus_default_labels, STRING prometheus_extra_labels) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C STRING xdb.stats( ENUM {json, prometheus} format=json, BOOL stream=0, STRING prometheus_name_prefix="vmod_redis_", BOOL prometheus_default_labels=1, STRING prometheus_extra_labels="" ) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B Arguments format: format of the output string. .sp stream: if enabled, the response object will be streamed as a synthetic response. .sp prometheus_name_prefix: prefix to be used in all Prometheus metric names. It\(aqs used as a raw value; no validations or transformations at all. .sp prometheus_default_labels: if enabled, some default Prometheus labels will be added to all stats. .sp prometheus_extra_labels: extra Prometheus labels to be added to all stats. It\(aqs used as a raw value; no validations or transformations at all. .TP .B Description Returns internal stats represented as a string. .sp If called during \fBvcl_synth\fP or \fBvcl_backend_error\fP with the \fBstream\fP argument enabled, this function will return an empty string and behave as a call to the \fBsynthetic\fP VCL function with the response object as input. This highly reduces the amount of required workspace memory. .UNINDENT .SS INT xdb.counter(STRING name) .INDENT 0.0 .TP .B Arguments name: name of the counter. .TP .B Description Returns internal counter. .UNINDENT .SH COPYRIGHT .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Copyright (c) 2014\-2022 Carlos Abalde You\(aqre free to use and distribute this under terms in the LICENSE file. .ft P .fi .UNINDENT .UNINDENT .\" Generated by docutils manpage writer. .