|
Moodle
2.2.1
http://www.collinsharper.com
|
Public Member Functions | |
| memcached () | |
| status () | |
| set ($key, $value, $ttl=0) | |
| get ($key) | |
| delete ($key) | |
| getforfill ($key) | |
| releaseforfill ($key) | |
Definition at line 46 of file memcached.class.php.
| 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
| $key | string |
Definition at line 125 of file memcached.class.php.
| memcached | ( | ) |
| releaseforfill | ( | $ | key | ) |
Release the exclusive lock obtained by getforfill(). See getforfill() for more details.
| $key | string |
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.