From 61738245e7510a8977edcc0305e8b70aaa4f086d Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Tue, 3 Feb 2009 00:18:50 +0000 Subject: [PATCH] memcached docs progress. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@275072 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/memcached/constants.xml | 9 +- reference/memcached/memcached/addservers.xml | 114 +++++++++++++++++++ reference/memcached/memcached/getoption.xml | 25 ++-- reference/memcached/memcached/set.xml | 58 +++++++--- reference/memcached/memcached/setoption.xml | 61 +++++----- 5 files changed, 211 insertions(+), 56 deletions(-) create mode 100644 reference/memcached/memcached/addservers.xml diff --git a/reference/memcached/constants.xml b/reference/memcached/constants.xml index c7024aa8bf..6828e3042b 100644 --- a/reference/memcached/constants.xml +++ b/reference/memcached/constants.xml @@ -1,5 +1,5 @@ - + &reftitle.constants; @@ -111,6 +111,13 @@ + + Memcached::OPT_LIBKETAMA_COMPATIBLE + + Description here... + + + Memcached::OPT_BUFFER_WRITES diff --git a/reference/memcached/memcached/addservers.xml b/reference/memcached/memcached/addservers.xml new file mode 100644 index 0000000000..05dd116efe --- /dev/null +++ b/reference/memcached/memcached/addservers.xml @@ -0,0 +1,114 @@ + + + + + + Memcached::addServers + The addServers purpose + + + + &reftitle.description; + + public voidMemcached::addServers + stringhost + stringport + stringweight + + + The method description goes here. + + + + + &reftitle.parameters; + + + + host + + + Description... + + + + + port + + + Description... + + + + + weight + + + Description... + + + + + + + + + &reftitle.returnvalues; + + Description... + + + + + &reftitle.examples; + + + <function>Memcached::addServers</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + Classname::Method + + + + + + + diff --git a/reference/memcached/memcached/getoption.xml b/reference/memcached/memcached/getoption.xml index 3ecc93d73b..f5740dbd0d 100644 --- a/reference/memcached/memcached/getoption.xml +++ b/reference/memcached/memcached/getoption.xml @@ -1,20 +1,23 @@ - + Memcached::getOption - The getOption purpose + Retrieve a Memcached option value &reftitle.description; public voidMemcached::getOption - stringoption + intoption - The method description goes here. + This method returns the value of a Memcached option. Some options + correspond to the ones defined by libmemcached, and some are specific to + the extension. See Memcached + Constants for more information. @@ -26,7 +29,7 @@ option - Description... + One of the Memcached::OPT_* constants. @@ -37,7 +40,8 @@ &reftitle.returnvalues; - Description... + Returns the value of the requested option, or FALSE on + error. @@ -45,18 +49,21 @@ &reftitle.examples; - <function>Memcached::getOption</function> example + Retrieving Memcached options getOption(Memcached::OPT_COMPRESSION)); +var_dump($m->getOption(Memcached::OPT_POLL_TIMEOUT)); ?> ]]> &example.outputs.similar; diff --git a/reference/memcached/memcached/set.xml b/reference/memcached/memcached/set.xml index b3e820eb9d..d3dd487acb 100644 --- a/reference/memcached/memcached/set.xml +++ b/reference/memcached/memcached/set.xml @@ -1,22 +1,31 @@ - + Memcached::set - The set purpose + Store data for a key &reftitle.description; - public voidMemcached::set + public boolMemcached::set stringkey - stringvalue - stringexpiration + mixedvalue + intexpiration - The method description goes here. + Memcached::set stores the value + on a memcache server under the specified key. The + expiration parameter is a Unix timestamp that can be + used to control when the value is considered expired. It can be set to + 0 which means that the value will persist until the + server deletes it to make space for new items. + The value can be any valid PHP type except for resources, because + those cannot be represented in a serialized form. If the + OPT_COMPRESSION option is turned on, the serialized + value will also be compressed before storage. @@ -28,7 +37,7 @@ key - Description... + The key under which to store the value. @@ -36,7 +45,7 @@ value - Description... + The value to store. @@ -44,7 +53,7 @@ expiration - Description... + The expiration time of the value, as a Unix timestamp. @@ -55,7 +64,8 @@ &reftitle.returnvalues; - Description... + &return.success; + Use Memcached::getResultCode if necessary. @@ -67,14 +77,36 @@ addServer('localhost', 11211); + +$m->set('int', 99); +$m->set('string', 'a simple string'); +$m->set('array', array(11, 12)); +/* expire 'object' key in 5 minutes */ +$m->set('object', new stdclass, time() + 300); + + +var_dump($m->get('int')); +var_dump($m->get('string')); +var_dump($m->get('array')); +var_dump($m->get('object')); ?> ]]> &example.outputs.similar; + int(11) + [1]=> + int(12) +} +object(stdClass)#1 (0) { +} ]]> @@ -85,7 +117,7 @@ &reftitle.seealso; - Classname::Method + Memcached::setByKey diff --git a/reference/memcached/memcached/setoption.xml b/reference/memcached/memcached/setoption.xml index 095766b691..5cdcb24aad 100644 --- a/reference/memcached/memcached/setoption.xml +++ b/reference/memcached/memcached/setoption.xml @@ -1,52 +1,42 @@ - + Memcached::setOption - The setOption purpose + Set a Memcached option &reftitle.description; public voidMemcached::setOption - stringoption - stringvalue + intoption + mixedvalue - The method description goes here. + This method sets the value of a Memcached option. + Some options correspond to the ones defined by libmemcached, and some are + specific to the extension. See Memcached Constants for more + information. - - - - &reftitle.parameters; - - - option - - - Description... - - - - - value - - - Description... - - - - + The options listed below require values specified via constants. + + + Memcached::OPT_HASH requires Memcached::HASH_* values. + + + Memcached::OPT_DISTRIBUTION requires Memcached::DISTRIBUTION_* values. + + &reftitle.returnvalues; - Description... + &return.success; @@ -54,18 +44,23 @@ &reftitle.examples; - <function>Memcached::setOption</function> example + Setting a Memcached option getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT); +$m->setOption(Memcached::OPT_HASH, Memcached::HASH_MURMUR); +$m->setOption(Memcached::OPT_PREFIX_KEY, "widgets"); +echo "Prefix key is now: ", $m->getOption(Memcached::OPT_PREFIX_KEY), "\n"; ?> ]]> - &example.outputs.similar; + &example.outputs; @@ -76,7 +71,7 @@ &reftitle.seealso; - Classname::Method + Memcached::getOption