Apache...NoLock(3pm)

πŸŽ€ Apache::Session::MySQL::NoLock πŸŽ€

okay bestie, so this is the User Contributed Perl Documentation page for Apache::Session::MySQL::NoLock β€” an implementation of Apache::Session::MySQL with no locking. Yes, you read that right. No locking. We'll get to the screaming part in a sec πŸ’€


✨ NAME ✨

Apache::Session::MySQL::NoLock β€” an implementation of Apache::Session::MySQL without locking. That's the whole vibe. That's the whole module. 🫢


🌸 SYNOPSIS 🌸

First, bestie, you gotta pull it in:

use Apache::Session::MySQL::NoLock;

#if you want Apache::Session to open new DB handles:

tie %hash, 'Apache::Session::MySQL::NoLock', $id, {
   DataSource => 'dbi:mysql:sessions',
   UserName => $db_user,
   Password => $db_pass,
};

#or, if your handles are already opened:

tie %hash, 'Apache::Session::MySQL::NoLock', $id, {
   Handle => $dbh,
};

Two paths, same destination: either you let Apache::Session open shiny new DB handles for you, or you hand it handles you already opened. Your call, main character. πŸ’…

And if you're trying to configure the non-locking session store in RT (which, ngl, is literally what the author uses this module for), drop this into your RT_SiteConfig.pm module:

Set($WebSessionClass , 'Apache::Session::MySQL::NoLock');

That's it. That's the config. Slay. ✨


πŸ’– DESCRIPTION πŸ’–

So here's the tea: this module is an implementation of Apache::Session. It uses the MySQL backing store and the Null locking scheme. That's the combo. 😌

For the full rundown, peep the example above, plus the documentation for Apache::Session::Store::MySQL β€” that's where the extra details live. iykyk πŸ“š


🚨 WARNING 🚨

okay bestie, sit down, we need to talk. 🫒

This module explicitly DOES NOT DO ANY LOCKING. That is not a typo, that is not a bug, that is the entire personality of this module.

Which means, fr fr: your session data can get overwritten, or stale data can be read by subsequent requests. 😭

And in case that wasn't loud enough:

This CAN CAUSE LARGE PROBLEMS IN YOUR APPLICATION.

like, LARGE large. Capital letters large. Don't say nobody warned you, bestie. πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

This module was written by Tomas Doran <bobtfish@bobtfish.net>. Iconic behavior, honestly. πŸŽ€


🌈 SEE ALSO 🌈

Go read these next, bestie, they're the whole friend group:

  • Apache::Session::MySQL
  • Apache::Session::Flex
  • Apache::Session

and that's a wrap! this lil page came to you from perl v5.36.0, dated 2022-11-19, filed under Apache...NoLock(3pm) in the User Contributed Perl Documentation collection. stay safe out there, and maybe think about locking. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from