Module resty.session.file
File storage backend for session library.
Configuration
configuration | File storage backend configuration |
Constructors
module.new ([configuration]) | Create a file 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
-
File storage backend configuration
Fields:
- prefix File prefix for session file.
- suffix
File suffix (or extension without
.
) for session file. - pool Name of the thread pool under which file writing happens (available on Linux only).
- path Path (or directory) under which session files are created.
Constructors
- module.new ([configuration])
-
Create a file storage.
This creates a new file storage instance.
Parameters:
- configuration table file storage configuration (optional)
Returns:
-
table
file 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: