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:

  1. true or nil ok
  2. string error message
file_append (path, data)
Append data in file.

Parameters:

Returns:

  1. true or nil ok
  2. string error message
file_read (path)
Read data from a file.

Parameters:

Returns:

  1. string or nil content
  2. string error message
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:

  • audience string session audience
  • subject string session subject

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
generated by LDoc 1.5.0 Last updated 2023-08-16 18:11:28