Module resty.session.file.utils
File storage utilities
Functions
file_create (path, content) | Store data in file. |
file_append (path, data) | Append data in file. |
file_read (path) | Read data from a file. |
get_modification (path) | Get the value modification time of a file. |
meta_get_key (audience, subject) | Given an audience and a subject, generate a metadata key. |
validate_file_name (prefix, suffix, name, filename) | Validate a file name. |
cleanup (path, prefix, suffix, name, current_time) | Clean up expired session and metadata files. |
Functions
- file_create (path, content)
-
Store data in file.
Parameters:
Returns:
- true or nil ok
- string error message
- file_append (path, data)
-
Append data in file.
Parameters:
Returns:
- true or nil ok
- string error message
- file_read (path)
-
Read data from a file.
Parameters:
- path string file to read
Returns:
- get_modification (path)
-
Get the value modification time of a file.
Parameters:
- path string the path to the file
- meta_get_key (audience, subject)
-
Given an audience and a subject, generate a metadata key.
Parameters:
Returns:
-
string
metadata key
- validate_file_name (prefix, suffix, name, filename)
-
Validate a file name.
Run a few checks to try to determine if the file is managed by this library
Parameters:
- prefix string the prefix for session files
- suffix string the suffix for session files
- name string cookie name
- filename string the name of the file
Returns:
-
true or false
whether the file is managed by the library or not
- cleanup (path, prefix, suffix, name, current_time)
-
Clean up expired session and metadata files.
Parameters:
- path string the path where sessions are stored
- prefix string the prefix for session files
- suffix string the suffix for session files
- name string cookie name
- current_time number current time
Returns:
-
true or false
whether clean up completed