Public Member Functions | |
MemCachedClient ($options=0) | |
set_servers ($servers) | |
set_debug ($do_debug) | |
forget_dead_hosts () | |
disconnect_all () | |
delete ($key, $time=0) | |
add ($key, $val, $exptime=0) | |
replace ($key, $val, $exptime=0) | |
set ($key, $val, $exptime=0) | |
get ($key) | |
get_multi ($keys) | |
incr ($key, $value=1) | |
decr ($key, $value=1) | |
error () | |
error_string () | |
error_clear () | |
set_compression ($setting=1) | |
sock_to_host ($host) | |
get_sock ($key) | |
_incrdecr ($cmdname, $key, $value) | |
_set ($cmdname, $key, $val, $exptime=0) | |
_load_items ($sock, &$val, $sock_keys) | |
_hashfunc ($num) | |
_debug ($text) | |
Public Attributes | |
$host_dead | |
$cache_sock | |
$debug | |
$servers | |
$active | |
$errno | |
$errstr | |
$compress = 1 | |
$comp_active = 1 | |
$bucket |
|
Constructor Creates a new MemCachedClient object Takes one parameter, a array of options. The most important key is $options["servers"], but that can also be set later with the set_servers() method. The servers must be an array of hosts, each of which is either a scalar of the form <10.0.0.10:11211> or an array of the former and an integer weight value. (the default weight if unspecified is 1.) It's recommended that weight values be kept as low as possible, as this module currently allocates memory for bucket distribution proportional to the total host weights. $options["debug"] turns the debugging on if set to true public
Definition at line 129 of file MemCachedClient.inc.php. References $options, and set_servers(). |
|
function that can be overridden to handle debug output by default debug info is print to the screen private
Definition at line 1147 of file MemCachedClient.inc.php. References _debug(). Referenced by _debug(), _incrdecr(), _load_items(), _set(), delete(), get(), get_multi(), get_sock(), and sock_to_host(). |
|
creates our hash private
Definition at line 1133 of file MemCachedClient.inc.php. References _hashfunc(). Referenced by _hashfunc(), and get_sock(). |
|
increments or decrements a numerical value in memcached. this function is called from incr() and decr() ONLY WORKS WITH NUMERIC VALUES Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ private
Definition at line 745 of file MemCachedClient.inc.php. References $sock, _debug(), _incrdecr(), MC_BUFFER_SZ, MC_ERR_GET_SOCK, MC_ERR_NOT_ACTIVE, MC_ERR_SOCKET_READ, and MC_ERR_SOCKET_WRITE. Referenced by _incrdecr(), decr(), and incr(). |
|
retrieves the value, and returns it unserialized Possible errors set are: MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ MC_ERR_GET_KEY MC_ERR_LOADITEM_END MC_ERR_LOADITEM_BYTES private
Definition at line 961 of file MemCachedClient.inc.php. References $errno, $line, _debug(), _load_items(), MC_BUFFER_SZ, MC_ERR_GET_KEY, MC_ERR_LOADITEM_BYTES, MC_ERR_LOADITEM_END, MC_ERR_SOCKET_READ, and MC_ERR_SOCKET_WRITE. Referenced by _load_items(), and get_multi(). |
|
sends the command to the server Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ MC_ERR_SET private
Definition at line 834 of file MemCachedClient.inc.php. References $errno, $sock, _debug(), _set(), MC_BUFFER_SZ, MC_ERR_GET_SOCK, MC_ERR_NOT_ACTIVE, MC_ERR_SET, MC_ERR_SOCKET_READ, and MC_ERR_SOCKET_WRITE. |
|
Like set(), but only stores in memcache if the key doesn't already exist. Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ MC_ERR_SET public
Definition at line 326 of file MemCachedClient.inc.php. Referenced by add(). |
|
Like incr, but decrements. Unlike incr, underflow is checked and new values are capped at 0. If server value is 1, a decrement of 2 returns 0, not -1. ONLY WORKS WITH NUMERIC VALUES Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ public
Definition at line 524 of file MemCachedClient.inc.php. References _incrdecr(), and decr(). Referenced by decr(). |
|
removes the key from the MemCache $time is the amount of time in seconds (or Unix time) until which the client wishes the server to refuse "add" and "replace" commands with this key. For this amount of item, the item is put into a delete queue, which means that it won't possible to retrieve it by the "get" command, but "add" and "replace" command with this key will also fail (the "set" command will succeed, however). After the time passes, the item is finally deleted from server memory. The parameter $time is optional, and, if absent, defaults to 0 (which means that the item will be deleted immediately and further storage commands with this key will succeed). Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ MC_ERR_DELETE public
Definition at line 221 of file MemCachedClient.inc.php. References $sock, _debug(), get_sock(), MC_BUFFER_SZ, MC_ERR_DELETE, MC_ERR_GET_SOCK, MC_ERR_NOT_ACTIVE, MC_ERR_SOCKET_READ, and MC_ERR_SOCKET_WRITE. |
|
disconnects from all servers public Definition at line 187 of file MemCachedClient.inc.php. |
|
When a function returns FALSE, an error code is set. This funtion will return the error code. See error_string() public
Definition at line 538 of file MemCachedClient.inc.php. |
|
Resets the error number and error string public Definition at line 562 of file MemCachedClient.inc.php. |
|
Returns a string describing the error set in error() See error() public
Definition at line 551 of file MemCachedClient.inc.php. |
|
remove all cached hosts that are no longer good public Definition at line 176 of file MemCachedClient.inc.php. |
|
Retrieves a key from the memcache. Returns the value (automatically unserialized, if necessary) or FALSE if it fails. The $key can optionally be an array, with the first element being the hash value, if you want to avoid making this module calculate a hash value. You may prefer, for example, to keep all of a given user's objects on the same memcache server, so you could use the user's unique id as the hash value. Possible errors set are: MC_ERR_GET_KEY public
Definition at line 393 of file MemCachedClient.inc.php. References _debug(), get(), get_multi(), and MC_ERR_GET_KEY. Referenced by get(). |
|
just like get(), but takes an array of keys, returns FALSE on error Possible errors set are: MC_ERR_NOT_ACTIVE public
Definition at line 421 of file MemCachedClient.inc.php. References $sock, _debug(), _load_items(), get_multi(), get_sock(), and MC_ERR_NOT_ACTIVE. Referenced by get(), and get_multi(). |
|
retrieves the socket associated with a key Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK private
Definition at line 672 of file MemCachedClient.inc.php. References $i, $sock, _debug(), _hashfunc(), get_sock(), MC_ERR_GET_SOCK, and MC_ERR_NOT_ACTIVE. Referenced by delete(), get_multi(), and get_sock(). |
|
Sends a command to the server to atomically increment the value for $key by $value, or by 1 if $value is undefined. Returns FALSE if $key doesn't exist on server, otherwise it returns the new value after incrementing. Value should be zero or greater. Overflow on server is not checked. Be aware of values approaching 2**32. See decr. ONLY WORKS WITH NUMERIC VALUES Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ public
Definition at line 502 of file MemCachedClient.inc.php. References _incrdecr(), and incr(). Referenced by incr(). |
|
Like set(), but only stores in memcache if the key already exists. returns TRUE on success else FALSE Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ MC_ERR_SET public
Definition at line 348 of file MemCachedClient.inc.php. References _set(), and replace(). Referenced by replace(). |
|
Unconditionally sets a key to a given value in the memcache. Returns true if it was stored successfully. The $key can optionally be an arrayref, with the first element being the hash value, as described above. Possible errors set are: MC_ERR_NOT_ACTIVE MC_ERR_GET_SOCK MC_ERR_SOCKET_WRITE MC_ERR_SOCKET_READ MC_ERR_SET public
Definition at line 372 of file MemCachedClient.inc.php. Referenced by set(). |
|
temporarily sets compression on or off turning it off, and then back on will result in the compression threshold going back to the original setting from $options
Definition at line 577 of file MemCachedClient.inc.php. References set_compression(). Referenced by set_compression(). |
|
if $do_debug is set to true, will print out debugging info, else debug is turned off public
Definition at line 165 of file MemCachedClient.inc.php. References set_debug(). Referenced by set_debug(). |
|
sets up the list of servers and the ports to connect to takes an array of servers in the same format as in the constructor public
Definition at line 151 of file MemCachedClient.inc.php. References $servers, and set_servers(). Referenced by MemCachedClient(), and set_servers(). |
|
connects to a server The $host may either a string int the form of host:port or an array of the former and an integer weight value. (the default weight if unspecified is 1.) See the constructor for details Possible errors set are: MC_ERR_HOST_FORMAT MC_ERR_HOST_DEAD MC_ERR_SOCKET_CONNECT private
Definition at line 606 of file MemCachedClient.inc.php. References $cache_sock, $conn, $sock, _debug(), MC_ERR_HOST_DEAD, MC_ERR_HOST_FORMAT, MC_ERR_SOCKET_CONNECT, and sock_to_host(). Referenced by sock_to_host(). |
|
Definition at line 82 of file MemCachedClient.inc.php. |
|
array that contains parsed out buckets @ var array Definition at line 108 of file MemCachedClient.inc.php. |
|
Definition at line 67 of file MemCachedClient.inc.php. Referenced by sock_to_host(). |
|
temp flag to turn compression on/off; defaults on @ var int Definition at line 102 of file MemCachedClient.inc.php. |
|
size of val to force compression; 0 turns off; defaults 1 @ var int Definition at line 97 of file MemCachedClient.inc.php. |
|
Definition at line 72 of file MemCachedClient.inc.php. |
|
Definition at line 87 of file MemCachedClient.inc.php. Referenced by _load_items(), and _set(). |
|
Definition at line 92 of file MemCachedClient.inc.php. |
|
Definition at line 62 of file MemCachedClient.inc.php. |
|
Definition at line 77 of file MemCachedClient.inc.php. Referenced by set_servers(). |