- SEE ALSO
- COPYRIGHT AND LICENSE
Maplat::Web::MemCachePg - PostgreSQL-backed memcache module
This is an API compatible implementation of Maplat::Web::MemCache. Internally, it uses that module in combination with the PostgreSQL webmodule.
You can use this module as a drop-in replacement of Maplat::Web::MemCache (that module still needs to be configured, though, because we used it here to speed up data retrieval). In addition of using the real memcache daemon, we also save the data to the configured database, e.g. implement a permanent storage engine on top of memcached.
And, yes, i know that there is a general Berkeley DB backed memcached available. This means you need still another database and it might not be available on all operating systems. If you choose to use the real db backed memcached, just use Maplat::Web::MemCache. This one uses the configured PostgreSQL module to do its stuff, so it should work everywhere where Maplat and PostgreSQL are available.
<module> <modname>memcachepg</modname> <pm>MemCachePg</pm> <options> <memcache>memcache</memcache> <db>maindb</db> </options> </module>
If you want to store data permanent (even within a single program run), you should use Maplat::Web::MemCachePg, which is using Maplat::Web::MemCache, but also uses the PostgreSQL module as a permanent backing store.
The memcache daemon itself is very fast, but is basically a cache; e.g. if more data comes in that it can hold, the oldest data is silently discarded. Therefore, using a backing store for things like Login-data, shopping cart contents and other things you want to permanently store, use a real backing store. You dont want to loose some session information because more users logged on than memcached was set to handle.
A few Maplat::Web:: modules implement their own caching strategy, like the UserSettings module. For these, you should *not* use Maplat::Web::MemCachePg but Maplat::Web::MemCache, otherwise you negate some of the performance due to overhead (double store).
Refresh the lifetick variable for this application in (real) memcached.
Disable the lifetick variable for this application in (real) memcached.
Save data in memcached.
Takes two arguments, a key name and a reference to the data to be stored in memcached. Returns a boolean to indicate success or failure.
Read data from memcached. Takes one argument, the key name, returns a reference to the data from memcached or undef.
Delete a key from memcached. Takes one argument, the key name, returns a boolean indicating success or failure.
Sets the command currently processed by this application (or 0 to indicate no active command). Takes one argument, the id of the currently active command. Returns a boolean indicating success or failure.
Returns a hash with all currently active commands in all (configured) workers, webguis and other apps.
Internal function to sanitize (clean up and re-encode) the memcached key string. Memcached has some limitations how the keys can be named, this functions is used on every access to memcached to make sure the keys adhere to this restrictions.
This module depends on Maplat::Web::MemCache and Maplat::Web::PostgresDB
Also Known As "database backed storage engine for general data junk".
If you are using MemCache on a production system for data you *must* be able to retrieve again, you really should be thinking of using THIS module instead of Maplat::Web::MemCache, unless you implement your own permanent storage solution.
Rene Schickbauer, <email@example.com>
Copyright (C) 2008-2011 by Rene Schickbauer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.