[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/ -> eaccelerator.class.php (summary)

(no description)

File Size: 132 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

eaccelerator:: (7 methods):
  eaccelerator()
  status()
  set()
  get()
  delete()
  getforfill()
  releaseforfill()


Class: eaccelerator  - X-Ref

This class abstracts eaccelerator/turckmmcache
API to provide

- get()
- set()
- delete()
- getforfill()
- releaseforfill()

Author: Martin Langhoff <martin@catalyst.net.nz>

Note: do NOT store booleans here. For compatibility with
memcached, a false value is indistinguisable from a
"not found in cache" response.
eaccelerator()   X-Ref
No description

status()   X-Ref
No description

set($key, $value, $ttl=0)   X-Ref
No description

get($key)   X-Ref
No description

delete($key)   X-Ref
No description

getforfill($key)   X-Ref
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

param: $key string
return: mixed on cache hit, false otherwise

releaseforfill($key)   X-Ref
Release the exclusive lock obtained by
getforfill(). See getforfill()
for more details.

param: $key string
return: bool



Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7