# Module `resty.session.redis.common`

Common Redis functions shared between Redis, Redis Cluster and Redis Sentinel implementations.

## Functions

module.SET (storage, red, name, key, value, ttl, current_time[, old_key], stale_ttl[, metadata], remember) | Store session data.
module.GET (storage, red, name, key) | Retrieve session data.
module.UNLINK (storage, red, name, key, current_time[, metadata]) | Delete session data.
module.READ_METADATA (storage, red, name, audience, subject, current_time) | Read session metadata.

## Functions

module.SET (storage, red, name, key, value, ttl, current_time[, old_key], stale_ttl[, metadata], remember)
  Store session data.

  ### Parameters:

  - storage table the storage
  - red table the redis instance
  - name string the 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
module.GET (storage, red, name, key)
  Retrieve session data.

  ### Parameters:

  - storage table the storage
  - red table the redis instance
  - name string cookie name
  - key string session key

  ### Returns:

  1. string or nil session data
  2. string error message
module.UNLINK (storage, red, name, key, current_time[, metadata])
  Delete session data.

  ### Parameters:

  - storage table the storage
  - red table the redis instance
  - name string cookie name
  - key string session key
  - current_time number current time
  - metadata table session meta data (optional)

  ### Returns:

  1. boolean or nil session data
  2. string error message
module.READ_METADATA (storage, red, name, audience, subject, current_time)
  Read session metadata.

  ### Parameters:

  - storage table the storage
  - red table the redis instance
  - 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