Apache::Session::Postgres – An implementation of Apache::Session
| Use Case | Command | Description |
|---|---|---|
| 🔗 Open new DB handles | tie %hash, 'Apache::Session::Postgres', $id, { DataSource => 'dbi:Pg:dbname=sessions', UserName => $db_user, Password => $db_pass, Commit => 1 } |
🔄 Creates a new database connection for session storage |
| 🔗 Use existing DB handle | tie %hash, 'Apache::Session::Postgres', $id, { Handle => $dbh, Commit => 1 } |
♻️ Reuses an existing DBI handle |
| ⚙️ Commit behavior | Commit => 1 (mandatory) |
✅ Commits transaction on completion; or use Commit => 0 to defer |
use Apache::Session::Postgres;
#if you want Apache::Session to open new DB handles:
tie %hash, 'Apache::Session::Postgres', $id, {
DataSource => 'dbi:Pg:dbname=sessions',
UserName => $db_user,
Password => $db_pass,
Commit => 1
};
#or, if your handles are already opened:
tie %hash, 'Apache::Session::Postgres', $id, {
Handle => $dbh,
Commit => 1
};
This module is an implementation of Apache::Session. It uses the Postgres backing store and no locking. See the example, and the documentation for Apache::Session::Store::Postgres for more details.
The special Apache::Session argument for this module is Commit. You MUST provide the Commit argument, which instructs this module to either commit the transaction when it is finished, or to simply do nothing. This feature is provided so that this module will not have adverse interactions with your local transaction policy, nor your local database handle caching policy. The argument is mandatory in order to make you think about this problem.
This module was written by Jeffrey William Baker <jwbaker AT acm.org>.
Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-16 09:54 @2600:1f28:365:80b0:7cb9:fb:26c1:e368
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)