SessionHandlerDB class

Installing this module makes ProcessWire store sessions in the database rather than the file system. Note that this module will log you out after install or uninstall.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the SessionHandlerDB class also inherits all the methods and properties of: WireSessionHandler, WireData and Wire.

Show class?             Show args?        


SessionHandlerDB::destroy(string $id)
boolDestroy the session indicated by the given session ID 
SessionHandlerDB::gc(int $seconds)
boolGarbage collection: remove stale sessions 
intReturn the number of active sessions in the last 5 mins (300 seconds) 
arrayReturn all session data for the given session ID 
arrayGet the most recent sessions 
SessionHandlerDB::lockSeconds int Max number of seconds to wait to obtain DB row lock. 
SessionHandlerDB::noPS int bool Prevent more than one session per logged-in user? 
SessionHandlerDB::read(string $id)
stringRead and return data for session indicated by $id 
SessionHandlerDB::retrySeconds int Seconds after which to retry after a lock fail. 
SessionHandlerDB::upgrade(int $fromVersion, int $toVersion)
(nothing)Upgrade module version
SessionHandlerDB::useIP int bool Track IP address? 
SessionHandlerDB::useUA int bool Track user agent? 
(nothing)Initialize the save handler when $modules sets the current instance 
SessionHandlerDB::write(string $id, string $data)
boolWrite the given $data for the given session ID 

Additional methods and properties

In addition to the methods and properties above, SessionHandlerDB also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.185

Twitter updates

  • ProcessWire 3.0.192 (dev branch) contains 11 issue fixes and 5 pull requests, over 20 commits— More
    7 January 2022
  • ProcessWire 3.0.191 core updates: updates to the installer and the profile exporter module— More
    24 December 2021
  • This week ProcessWire went on a diet, trimming the core size from 15.5 MB down to 7.5 MB by moving optional site profiles into their own GitHub repos— More
    17 December 2021

Latest news

  • ProcessWire Weekly #401
    In the 401st issue of ProcessWire Weekly we'll cover the latest core updates, check out a brand new module called Lister Native Date Format, and more. Read on! / 15 January 2022
  • ProcessWire 3.0.190 core updates
    ProcessWire 3.0.190 has 15 commits relative to 3.0.189 and contains a mixture of issue resolutions and feature additions. This post covers them all, in addition to updates for the PageAutosave and ProFields Table modules.
    Blog / 3 December 2021
  • Subscribe to weekly ProcessWire news

I just love the easy and intuitive ProcessWire API. ProcessWire rocks!” —Jens Martsch, Web developer