# 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.
instance:read_metadata (name, audience, subject, current_time) | Read session metadata.

## 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 SSK (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:

  - configuration table redis sentinel storage configuration (optional)

  ### 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 (optional)
  - stale_ttl string stale ttl
  - metadata table table of metadata (optional)
  - 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:

  - name string cookie name
  - key string session key

  ### 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
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:

  1. table or nil session metadata
  2. string error message

generated by LDoc 1.5.0 Last updated 2025-07-29 12:02:00