- SEE ALSO
- COPYRIGHT AND LICENSE
Maplat::Web::MemCacheSim - Simulated Maplat::Web::MemCache
This is a simulation of Maplat::Web::MemCache for testing on systems without running memcached.
This module provides a web module that gives the caller an interface to the (simulated) memcached service.
The API is compatible to Maplat::Web::Memcache but it does not share data between processes and forks. At least not in the way you might expect.
Do not use in production systems - this module exists for the sole purpose of running some tests without having to have a running memcached daemon.
<module> <modname>memcache</modname> <pm>MemCache</pm> <options> <service>127.0.0.1:11211</service> <namespace>RBSMem</namespace> <viewcommands> <view>Adm Worker</view> <view>Other Worker</view> </viewcommands> </options> </module>
service is IP address and port of the memcached service - which is ignored and exists only because the *real* module also needs it.
namespace if a single name assigned to all programs of the same project. Different projects accessing the same memcached server must use different namespaces, while all programs working on a common project must use the same namespace. this is so, because next to caching, memcached in the Maplat framework is also used for interprocess communication.
maxage is the maximum age in days the files are allowed to reside in the directory
Further, the main script must declare the variables $VERSION and $APPNAME, because some functionality of the wrapper needs those. This values are set in memcached and can be read out by the WebGUI as a central point of determing which versions and build of which program are running on the server. So, the variables
must be accesible and hold reasonable values.
viewcommands is a list of workers that can work on the commandqueue table. This helps checking every worker for active commands and highlighting them in various other modules
Refreshed the lifetick variable for this application in 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 reconnect to the memcache daemon after forking.
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 is a basic module which does not depend on other web modules.
Also Known As "memcached for CPAN testers".
If you are using MemCacheSim on a production system, now would be a good time to panic.
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.