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

Public Member Functions

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

Detailed Description

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


Member Function Documentation

delete ( key)
Todo:
Document this function
Parameters:
string$key
Returns:
mixed

Definition at line 119 of file eaccelerator.class.php.

Todo:
Document this function

object

Definition at line 53 of file eaccelerator.class.php.

Here is the call graph for this function:

get ( key)
Todo:
Document this function
Parameters:
string$key
Returns:
string|bool String if success else false

Definition at line 104 of file eaccelerator.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, false otherwise

Definition at line 149 of file eaccelerator.class.php.

releaseforfill ( key)

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

Parameters:
$keystring
Returns:
bool

Definition at line 183 of file eaccelerator.class.php.

set ( key,
value,
ttl = 0 
)
Todo:
Document this function
Parameters:
string$key
string$value
int$ttl
Returns:
mixed

Definition at line 87 of file eaccelerator.class.php.

status ( )

The status of the eaccelerator, if it has been established this will return true

Returns:
bool

Definition at line 72 of file eaccelerator.class.php.


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