Module resty.session.redis.cluster
Redis Cluster backend for session library
Configuration
configuration | Redis Cluster storage backend configuration |
nodes | Cluster Nodes |
node | Cluster Node |
Constructors
module.new ([configuration]) | Create a Redis Cluster storage. |
Storage
instance:set (name, key, value, ttl, current_time[, old_key], stale_ttl[, metadata], remember) | Store session data. |
instance:get (name, key) | Retrieve session data. |
instance:delete (name, key[, metadata]) | Delete session data. |
instance:read_metadata (name, audience, subject, current_time) | Read session metadata. |
Configuration
- configuration
-
Redis Cluster storage backend configuration
Fields:
- prefix Prefix for the keys stored in redis.
- suffix Suffix for the keys stored in redis.
- name Redis cluster name.
- nodes Redis cluster nodes.
- lock_zone Shared dictionary name for locks.
- lock_prefix Shared dictionary name prefix for lock.
- max_redirections Maximum retry attempts for redirection.
- max_connection_attempts Maximum retry attempts for connection.
- max_connection_timeout Maximum connection timeout in total among the retries.
- username The database username to authenticate.
- password Password for authentication.
- connect_timeout
Controls the default timeout value used in TCP/unix-domain socket object’s
connect
method. - send_timeout
controls The default timeout value used in TCP/unix-domain socket object’s
send
method. - read_timeout
controls The default timeout value used in TCP/unix-domain socket object’s
receive
method. - keepalive_timeout Controls the default maximal idle time of the connections in the connection pool.
- pool A custom name for the connection pool being used.
- pool_size The size of the connection pool.
- backlog A queue size to use when the connection pool is full (configured with @pool_size).
- ssl
Enable SSL (defaults to
false
). - ssl_verify
Verify server certificate (defaults to
nil
). - server_name The server name for the new TLS extension Server Name Indication (SNI).
- nodes
- Cluster Nodes An array of cluster nodes.
- node
-
Cluster Node
Fields:
- ip
The IP address to connect (defaults to
"127.0.0.1"
). - port
The port to connect (defaults to
6379
).
- ip
The IP address to connect (defaults to
Constructors
- module.new ([configuration])
-
Create a Redis Cluster storage.
This creates a new Redis Cluster storage instance.
Parameters:
- configuration table redis cluster storage configuration (optional)
Returns:
-
table
redis cluster storage instance
Storage
- instance:set (name, key, value, ttl, current_time[, old_key], stale_ttl[, metadata], remember)
-
Store session data.
Parameters:
- name string cookie name
- key string session key
- value string session value
- ttl number session ttl
- current_time number current time
- old_key string old session id (optional)
- stale_ttl string stale ttl
- metadata table table of metadata (optional)
- remember boolean whether storing persistent session or not
Returns:
- true or nil ok
- string error message
- instance:get (name, key)
-
Retrieve session data.
Parameters:
Returns:
- instance:delete (name, key[, metadata])
-
Delete session data.
Parameters:
Returns:
- boolean or nil session data
- string error message
- instance:read_metadata (name, audience, subject, current_time)
-
Read session metadata.
Parameters:
- name string cookie name
- audience string session key
- subject string session key
- current_time number current time
Returns: