Moodle  2.2.1
http://www.collinsharper.com
memcached Class Reference

Public Member Functions

 memcached ()
 status ()
 set ($key, $value, $ttl=0)
 get ($key)
 delete ($key)
 getforfill ($key)
 releaseforfill ($key)

Detailed Description

Definition at line 46 of file memcached.class.php.


Member Function Documentation

delete ( key)

Definition at line 96 of file memcached.class.php.

get ( key)

Definition at line 91 of file memcached.class.php.

getforfill ( key)

In the simple case, this function will get the cached value if available. If the entry is not cached, it will try to get an exclusive lock that announces that this process will populate the cache.

If we fail to get the lock -- this means another process is doing it. so we wait (block) for a few microseconds while we wait for the cache to be filled or the lock to timeout.

If you get a false from this call, you _must_ populate the cache ASAP or indicate that you won't by calling releaseforfill().

This technique forces serialisation and so helps deal with thundering herd scenarios where a lot of clients ask the for the same idempotent (and costly) operation. The implementation is based on suggestions in this message http://marc.theaimsgroup.com/?l=git&m=116562052506776&w=2

Parameters:
$keystring
Returns:
mixed on cache hit, NULL otherwise

Definition at line 125 of file memcached.class.php.

memcached ( )

Definition at line 48 of file memcached.class.php.

Here is the call graph for this function:

releaseforfill ( key)

Release the exclusive lock obtained by getforfill(). See getforfill() for more details.

Parameters:
$keystring
Returns:
bool

Definition at line 157 of file memcached.class.php.

set ( key,
value,
ttl = 0 
)

Definition at line 82 of file memcached.class.php.

status ( )

Definition at line 75 of file memcached.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations