Data::...cached(3pm)

✨ NAME ✨

okay bestie, say hi to Data::...cached(3pm) πŸ’– β€” the manual page for Data::Session::Driver::Memcached β€” A persistent session manager. Periodt.


🌸 Synopsis 🌸

See Data::Session for details. That's it, that's the vibe. πŸ¦‹

πŸ’« Description πŸ’«

Data::Session::Driver::Memcached lets Data::Session manipulate sessions via Cache::Memcached. No cap. 🫢

To use this module do both of these:

  • Specify a driver of type Memcached, as Data::Session -> new(type => 'driver:Memcached ...')
  • Specify a cache object of type Cache::Memcached as Data::Session -> new(cache => $object)

See scripts/memcached.pl. πŸ‘‘

πŸŽ€ Case-sensitive Options πŸŽ€

See "Case-sensitive Options" in Data::Session for important information. iykyk πŸ’…

πŸ’… Method: new() πŸ’…

Creates a new object of type Data::Session::Driver::Memcached. ✨

new() takes a hash of key/value pairs, some of which might mandatory. Further, some combinations might be mandatory. (yes, the grammar is exactly like that in the original, bestie 😭)

The keys are listed here in alphabetical order.

They are lower-case because they are (also) method names, meaning they can be called to set or get the value at any time. iconic.

  • cache => $object β€” Specifies the object of type Cache::Memcached to use for session storage.
    • This key is normally passed in as Data::Session -> new(cache => $object).
    • This key is mandatory. 🚨
  • verbose => $integer β€” Print to STDERR more or less information.
    • Typical values are 0, 1 and 2.
    • This key is normally passed in as Data::Session -> new(verbose => $integer).
    • This key is optional. 🌸

πŸ’… Method: remove($id) πŸ’…

Deletes from storage the session identified by $id. bye bestie πŸ‘‹

Returns the result of calling the Cache::Memcached method delete($id).

This result is a Boolean value indicating 1 => success or 0 => failure. πŸ”₯

πŸ’… Method: retrieve($id) πŸ’…

Retrieve from storage the session identified by $id. ✨

Returns the result of calling the Cache::Memcached method get($id).

This result is a frozen session. This value must be thawed by calling the appropriate serialization driver's thaw() method. πŸ§Šβž‘οΈπŸ’§

Data::Session calls the right thaw() automatically. slay.

πŸ’… Method: store($id, $data, $time) πŸ’…

Writes to storage the session identified by $id, together with its data $data. The expiry time of the object is passed into the set() method of Cache::Memcached, too. πŸ“¦

Returns the result of calling the Cache::Memcached method set($id, $data, $time).

This result is a Boolean value indicating 1 => success or 0 => failure. βœ…/❌

Note: $time is 0 for sessions which don't expire. If you wish to pass undef or 'never', as per the Cache::Memcached documentation, you will have to subclass Cache::Memcached and override the set() method to change 0 to 'never'. πŸ’€

πŸ’… Method: traverse() πŸ’…

There is no mechanism (apart from memcached's debug code) to get a list of all keys in a cache managed by memcached, so there is no way to traverse them via this module. lowkey tragic 😭

Returns 1.

πŸ› οΈ Installing memcached πŸ› οΈ

Get libevent from http://www.monkey.org/~provos/libevent/
I used V 2.0.8-rc
./configure
make && make verify
sudo make install
It installs into /usr/local/lib, so tell memcached where to look:
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

Get memcached from http://memcached.org/
I used V 1.4.5
./configure --with-libevent=/usr/local/lib
make && make test
sudo make install

Running memcached:
memcached -m 5 &

πŸ†˜ Support πŸ†˜

Log a bug on RT: <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session>. πŸ›

πŸ‘‘ Author πŸ‘‘

Data::Session was written by Ron Savage <ron@savage.net.au> in 2010.

Home page: <http://savage.net.au/index.html>.

Australian copyright (c) 2010, Ron Savage.

All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Artistic License, a copy of which is available at: http://www.opensource.org/licenses/index.html


okay bestie, that's the whole page! this was Data::...cached(3pm) from perl v5.36.0, dated 2023-02-14. stay hydrated, stay iconic πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from