Module resty.session.redis-sentinel

Redis Sentinel backend for session library

Configuration

configuration Redis Sentinel storage backend configuration
sentinels Sentinels
sentinel Sentinel

Constructors

module.new ([configuration]) Create a Redis Sentinel 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.


Configuration

configuration
Redis Sentinel storage backend configuration

Fields:

  • prefix prefix for the keys stored in redis
  • suffix suffix for the keys stored in redis
  • master name of master
  • role "master" or "slave"
  • sentinels redis sentinels
  • sentinel_username optional sentinel username
  • sentinel_password optional sentinel password
  • username the database username to authenticate
  • password password for authentication
  • database the database to connect
  • 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)
sentinels
Sentinels An array of sentinels.
sentinel
Sentinel

Fields:

  • host the host to connect
  • port the port to connect

Constructors

module.new ([configuration])
Create a Redis Sentinel storage.

This creates a new Redis Sentinel storage instance.

Parameters:

Returns:

    table redis sentinel 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
  • stale_ttl string stale ttl
  • metadata table table of metadata
  • remember table whether storing persistent session or not

Returns:

  1. true or nil ok
  2. string error message
instance:get (name, key)
Retrieve session data.

Parameters:

Returns:

  1. string or nil session data
  2. string error message
instance:delete (name, key[, metadata])
Delete session data.

Parameters:

  • name string cookie name
  • key string session key
  • metadata table session meta data (optional)

Returns:

  1. boolean or nil session data
  2. string error message
generated by LDoc 1.4.6 Last updated 2022-12-23 14:06:58