The module provides access to the distributed hash table memcached. This hash table is stored in memory and can can be accessed via a pseudo-variable: $mct(key). Entries are stored and retrieved from an external server application. The “key” can be a static string and also any existing pseudo-variable. Further interfaces to the functionality provided from memcached are also provided, like access to the atomic increment and decrement operations. Example 1.1. Storing and retrieving entries ... $mct(test) = 1; xlog("stored value is $mct(test)"); $mct(test) = $null; # delete it xlog("stored value is $mct(test)"); # will return <null> or empty string ... Example 1.2. Using atomic operations ... $mct(cnt) = 1; $mcinc(cnt) = 1; # increment by 1 xlog("counter is now $mct(cnt)"); $mcdec(cnt) = 1; # decrement by 1 xlog("counter is now $mct(cnt)"); ... Example 1.3. Set custom expire time when adding an entry ... $mct(test=>10) = 1; xlog("stored value is $mct(test)"); # sleep 10 seconds xlog("stored value is $mct(test)"); # will return <null> ... Example 1.4. Modifying expire time for existing entries ... $mct(test) = 1; xlog("stored value is $mct(test)"); $mctex(test) = 10; # set expire time to 10 seconds # sleep 10 seconds xlog("stored value is $mct(test)"); # will return <null> ... This module is an addition to the existing htable functionality, not a replacement. In smaller architectures or installations where only one instance needs access to the hash table the htable module is easi
Copyright © 2009 Henning Westerholt