Module resty.session.shm
Shared Memory (SHM) backend for session library
Configuration
configuration | Shared memory storage backend configuration |
Constructors
module.new ([configuration]) | Create a SHM 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
-
Shared memory storage backend configuration
Fields:
- prefix Prefix for the keys stored in SHM.
- suffix Suffix for the keys stored in SHM.
- zone
A name of shared memory zone (defaults to
sessions
).
Constructors
- module.new ([configuration])
-
Create a SHM storage.
This creates a new shared memory storage instance.
Parameters:
- configuration table shm storage configuration (optional)
Returns:
-
table
shm 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: