[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
Memcached client for PHP. +---------------------------------------------------------------------------+ | memcached client, PHP | +---------------------------------------------------------------------------+ | Copyright (c) 2003 Ryan T. Dean <[email protected]> | | All rights reserved. | | | | Redistribution and use in source and binary forms, with or without | | modification, are permitted provided that the following conditions | | are met: | | | | 1. Redistributions of source code must retain the above copyright | | notice, this list of conditions and the following disclaimer. | | 2. Redistributions in binary form must reproduce the above copyright | | notice, this list of conditions and the following disclaimer in the | | documentation and/or other materials provided with the distribution. | | | | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | +---------------------------------------------------------------------------+ | Author: Ryan T. Dean <[email protected]> | | Heavily influenced by the Perl memcached client by Brad Fitzpatrick. | | Permission granted by Brad Fitzpatrick for relicense of ported Perl | | client logic under 2-clause BSD license. | +---------------------------------------------------------------------------+
File Size: | 1263 lines (31 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
MWMemcached:: (37 methods):
__construct()
add()
decr()
delete()
lock()
unlock()
disconnect_all()
enable_compress()
forget_dead_hosts()
get()
get_multi()
incr()
replace()
run_command()
set()
cas()
set_compress_threshold()
set_debug()
set_servers()
set_timeout()
_close_sock()
_connect_sock()
_dead_sock()
_dead_host()
get_sock()
_hashfunc()
_incrdecr()
_load_items()
_set()
sock_to_host()
_debugprint()
_error_log()
_fwrite()
_handle_error()
_fread()
_fgets()
_flush_read_buffer()
MemCachedClientforWiki:: (0 methods):
Class: MWMemcached - X-Ref
memcached client class implemented using (p)fsockopen()__construct( $args ) X-Ref |
Memcache initializer param: array $args Associative array of settings return: mixed |
add( $key, $val, $exp = 0 ) X-Ref |
Adds a key/value to the memcache server if one isn't already set with that key param: string $key Key to set with data param: mixed $val Value to store param: int $exp (optional) Expiration time. This can be a number of seconds return: bool |
decr( $key, $amt = 1 ) X-Ref |
Decrease a value stored on the memcache server param: string $key Key to decrease param: int $amt (optional) amount to decrease return: mixed False on failure, value on success |
delete( $key, $time = 0 ) X-Ref |
Deletes a key from the server, optionally after $time param: string $key Key to delete param: int $time (optional) how long to wait before deleting return: bool True on success, false on failure |
lock( $key, $timeout = 0 ) X-Ref |
param: string $key param: int $timeout return: bool |
unlock( $key ) X-Ref |
param: string $key return: bool |
disconnect_all() X-Ref |
Disconnects all connected sockets |
enable_compress( $enable ) X-Ref |
Enable / Disable compression param: bool $enable True to enable, false to disable |
forget_dead_hosts() X-Ref |
Forget about all of the dead hosts |
get( $key, &$casToken = null ) X-Ref |
Retrieves the value associated with the key from the memcache server param: array|string $key key to retrieve param: float $casToken [optional] return: mixed |
get_multi( $keys ) X-Ref |
Get multiple keys from the server(s) param: array $keys Keys to retrieve return: array |
incr( $key, $amt = 1 ) X-Ref |
Increments $key (optionally) by $amt param: string $key Key to increment param: int $amt (optional) amount to increment return: int|null Null if the key does not exist yet (this does NOT |
replace( $key, $value, $exp = 0 ) X-Ref |
Overwrites an existing value for key; only works if key is already set param: string $key Key to set value as param: mixed $value Value to store param: int $exp (optional) Expiration time. This can be a number of seconds return: bool |
run_command( $sock, $cmd ) X-Ref |
Passes through $cmd to the memcache server connected by $sock; returns output as an array (null array if no output) param: Resource $sock Socket to send command on param: string $cmd Command to run return: array Output array |
set( $key, $value, $exp = 0 ) X-Ref |
Unconditionally sets a key to a given value in the memcache. Returns true if set successfully. param: string $key Key to set value as param: mixed $value Value to set param: int $exp (optional) Expiration time. This can be a number of seconds return: bool True on success |
cas( $casToken, $key, $value, $exp = 0 ) X-Ref |
Sets a key to a given value in the memcache if the current value still corresponds to a known, given value. Returns true if set successfully. param: float $casToken Current known value param: string $key Key to set value as param: mixed $value Value to set param: int $exp (optional) Expiration time. This can be a number of seconds return: bool True on success |
set_compress_threshold( $thresh ) X-Ref |
Sets the compression threshold param: int $thresh Threshold to compress if larger than |
set_debug( $dbg ) X-Ref |
Sets the debug flag param: bool $dbg True for debugging, false otherwise |
set_servers( $list ) X-Ref |
Sets the server list to distribute key gets and puts between param: array $list Array of servers to connect to |
set_timeout( $seconds, $microseconds ) X-Ref |
Sets the timeout for new connections param: int $seconds Number of seconds param: int $microseconds Number of microseconds |
_close_sock( $sock ) X-Ref |
Close the specified socket param: string $sock Socket to close |
_connect_sock( &$sock, $host ) X-Ref |
Connects $sock to $host, timing out after $timeout param: int $sock Socket to connect param: string $host Host:IP to connect to return: bool |
_dead_sock( $sock ) X-Ref |
Marks a host as dead until 30-40 seconds in the future param: string $sock Socket to mark as dead |
_dead_host( $host ) X-Ref |
param: string $host |
get_sock( $key ) X-Ref |
get_sock param: string $key Key to retrieve value for; return: Resource|bool Resource on success, false on failure |
_hashfunc( $key ) X-Ref |
Creates a hash integer based on the $key param: string $key Key to hash return: int Hash value |
_incrdecr( $cmd, $key, $amt = 1 ) X-Ref |
Perform increment/decriment on $key param: string $cmd Command to perform param: string|array $key Key to perform it on param: int $amt Amount to adjust return: int New value of $key |
_load_items( $sock, &$ret, &$casToken = null ) X-Ref |
Load items into $ret from $sock param: Resource $sock Socket to read from param: array $ret returned values param: float $casToken [optional] return: bool True for success, false for failure |
_set( $cmd, $key, $val, $exp, $casToken = null ) X-Ref |
Performs the requested storage operation to the memcache server param: string $cmd Command to perform param: string $key Key to act on param: mixed $val What we need to store param: int $exp (optional) Expiration time. This can be a number of seconds param: float $casToken [optional] return: bool |
sock_to_host( $host ) X-Ref |
Returns the socket for the host param: string $host Host:IP to get socket for return: Resource|bool IO Stream or false |
_debugprint( $text ) X-Ref |
param: string $text |
_error_log( $text ) X-Ref |
param: string $text |
_fwrite( $sock, $buf ) X-Ref |
Write to a stream. If there is an error, mark the socket dead. param: Resource $sock The socket param: string $buf The string to write return: bool True on success, false on failure |
_handle_error( $sock, $msg ) X-Ref |
Handle an I/O error. Mark the socket dead and log an error. param: Resource $sock param: string $msg |
_fread( $sock, $len ) X-Ref |
Read the specified number of bytes from a stream. If there is an error, mark the socket dead. param: Resource $sock The socket param: int $len The number of bytes to read return: string|bool The string on success, false on failure. |
_fgets( $sock ) X-Ref |
Read a line from a stream. If there is an error, mark the socket dead. The \r\n line ending is stripped from the response. param: Resource $sock The socket return: string|bool The string on success, false on failure |
_flush_read_buffer( $f ) X-Ref |
Flush the read buffer of a stream param: Resource $f |
Class: MemCachedClientforWiki - X-Ref
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |