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?        

Common

NameReturnSummary 
SessionHandlerDB::destroy(string $id)
boolDestroy the session indicated by the given session ID 
SessionHandlerDB::gc(int $seconds)
boolGarbage collection: remove stale sessions 
SessionHandlerDB::getNumSessions()
intReturn the number of active sessions in the last 5 mins (300 seconds) 
SessionHandlerDB::getSessionData($sessionID)
arrayReturn all session data for the given session ID 
SessionHandlerDB::getSessions()
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? 
SessionHandlerDB::wired()
(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.184

Twitter updates

  • ProcessWire 3.0.185 (dev) core updates, plus new Session Allow module— More
    17 September 2021
  • Three new ProcessWire Textformatter modules: Find/Replace, Markdown in Markup, and Emoji— More
    3 September 2021
  • This week we have a new master version released after a year in the making. With nearly 40 pull requests, hundreds of new additions and more than 100 issue reports resolved, this new version has a ton of great new stuff— More
    27 August 2021

Latest news

  • ProcessWire Weekly #384
    In the 384th issue of ProcessWire Weekly we'll cover the latest core updates, introduce a new module called Session Allow, and highlight a new site of the week. Read on!
    Weekly.pw / 18 September 2021
  • ProcessWire 3.0.184 new master/main version
    This week we have a new master/main version released after a full year in the making. As you might imagine, this new version has a ton of great new stuff and we’ll try to cover much of it here.
    Blog / 27 August 2021
  • Subscribe to weekly ProcessWire news

“We were really happy to build our new portfolio website on ProcessWire! We wanted something that gave us plenty of control on the back-end, without any bloat on the front end - just a nice, easy to access API for all our content that left us free to design and build however we liked.” —Castus, web design agency in Sheffield, UK