From 1e1ef2743f4c6883585559efc5bc27277a52fad7 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Thu, 5 Feb 2009 00:48:47 +0000 Subject: [PATCH] memcached docs progress git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@275198 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/memcached/memcached/fetch.xml | 54 ++++++++++++-- reference/memcached/memcached/fetchall.xml | 55 +++++++++++--- reference/memcached/memcached/get.xml | 8 +- reference/memcached/memcached/getbykey.xml | 4 +- reference/memcached/memcached/getdelayed.xml | 74 +++++++++++++++---- .../memcached/memcached/getdelayedbykey.xml | 52 +++++-------- 6 files changed, 175 insertions(+), 72 deletions(-) diff --git a/reference/memcached/memcached/fetch.xml b/reference/memcached/memcached/fetch.xml index 8cab41411e..46291e0b85 100644 --- a/reference/memcached/memcached/fetch.xml +++ b/reference/memcached/memcached/fetch.xml @@ -1,20 +1,21 @@ - + Memcached::fetch - The fetch purpose + Fetch the next result &reftitle.description; - public voidMemcached::fetch + public mixedMemcached::fetch - The method description goes here. + Memcached::fetch retrieves the next result from the + last request. @@ -26,7 +27,9 @@ &reftitle.returnvalues; - Description... + Returns the next result or &false; otherwise. + The Memcached::getResultCode will return + Memcached::RES_END if result set is exhausted. @@ -38,14 +41,48 @@ addServer('localhost', 11211); + +$m->set('int', 99); +$m->set('string', 'a simple string'); +$m->set('array', array(11, 12)); + +$m->getDelayed(array('int', 'array'), true); +while ($result = $m->fetch()) { + var_dump($result); +} ?> ]]> &example.outputs.similar; + array(3) { + ["key"]=> + string(3) "int" + ["value"]=> + int(99) + ["cas"]=> + float(2363) + } + [1]=> + array(3) { + ["key"]=> + string(5) "array" + ["value"]=> + array(2) { + [0]=> + int(11) + [1]=> + int(12) + } + ["cas"]=> + float(2365) + } +} ]]> @@ -56,7 +93,8 @@ &reftitle.seealso; - Classname::Method + Memcached::fetchAll + Memcached::getDelayed diff --git a/reference/memcached/memcached/fetchall.xml b/reference/memcached/memcached/fetchall.xml index ab83e50235..0ae3a54aba 100644 --- a/reference/memcached/memcached/fetchall.xml +++ b/reference/memcached/memcached/fetchall.xml @@ -1,20 +1,21 @@ - + Memcached::fetchAll - The fetchAll purpose + Fetch all the remaining results &reftitle.description; - public voidMemcached::fetchAll + public mixedMemcached::fetchAll - The method description goes here. + Memcached::fetchAll retrieves all the remaining + results from the last request. @@ -26,7 +27,8 @@ &reftitle.returnvalues; - Description... + Returns the results or &false; on failure. + Use Memcached::getResultCode if necessary. @@ -34,18 +36,50 @@ &reftitle.examples; - <function>Memcached::fetchAll</function> example + <function>Memcached::getDelayed</function> example addServer('localhost', 11211); + +$m->set('int', 99); +$m->set('string', 'a simple string'); +$m->set('array', array(11, 12)); + +$m->getDelayed(array('int', 'array'), true); +var_dump($m->fetchAll()); ?> ]]> - &example.outputs.similar; + &example.outputs; + array(3) { + ["key"]=> + string(3) "int" + ["value"]=> + int(99) + ["cas"]=> + float(2363) + } + [1]=> + array(3) { + ["key"]=> + string(5) "array" + ["value"]=> + array(2) { + [0]=> + int(11) + [1]=> + int(12) + } + ["cas"]=> + float(2365) + } +} ]]> @@ -56,7 +90,8 @@ &reftitle.seealso; - Classname::Method + Memcached::fetch + Memcached::getDelayed diff --git a/reference/memcached/memcached/get.xml b/reference/memcached/memcached/get.xml index 9036955849..cf9c9f90f8 100644 --- a/reference/memcached/memcached/get.xml +++ b/reference/memcached/memcached/get.xml @@ -1,5 +1,5 @@ - + @@ -22,7 +22,7 @@ CAS token value for the item. See Memcached::cas for how to use CAS tokens. Read-through caching callback may be - specified via cache_cb. + specified via cache_cb parameter. @@ -44,7 +44,7 @@ cache_cb - Read-through caching callback or &null; + Read-through caching callback or &null;. @@ -63,7 +63,7 @@ &reftitle.returnvalues; - Returns the value stored in the cache or &false; on failure. + Returns the value stored in the cache or &false; otherwise. The Memcached::getResultCode will return Memcached::RES_NOTFOUND if the key does not exist. diff --git a/reference/memcached/memcached/getbykey.xml b/reference/memcached/memcached/getbykey.xml index 814e52642b..07c6c96b1c 100644 --- a/reference/memcached/memcached/getbykey.xml +++ b/reference/memcached/memcached/getbykey.xml @@ -1,5 +1,5 @@ - + @@ -67,7 +67,7 @@ &reftitle.returnvalues; - Returns the value stored in the cache or &false; on failure. + Returns the value stored in the cache or &false; otherwise. The Memcached::getResultCode will return Memcached::RES_NOTFOUND if the key does not exist. diff --git a/reference/memcached/memcached/getdelayed.xml b/reference/memcached/memcached/getdelayed.xml index 2fabeb12d6..1366b77611 100644 --- a/reference/memcached/memcached/getdelayed.xml +++ b/reference/memcached/memcached/getdelayed.xml @@ -1,22 +1,33 @@ - + Memcached::getDelayed - The getDelayed purpose + Request multiple items &reftitle.description; - public voidMemcached::getDelayed + public boolMemcached::getDelayed arraykeys - stringwith_cas - stringvalue_cb + boolwith_cas + callbackvalue_cb - The method description goes here. + Memcached::getDelayed issues a request to memcache for + multiple items the keys of which are specified in the + keys array. The method does not wait for response + and returns right away. When you are ready to collect the items, call + either Memcached::fetch or + Memcached::fetchAll. If with_cas + is true, the CAS token values will also be requested. + + + Instead of fetching the results explicitly, you can specify a result callback via + value_cb parameter. @@ -28,7 +39,7 @@ keys - Description... + Array of keys to request. @@ -36,7 +47,7 @@ with_cas - Description... + Whether to request CAS token values also. @@ -44,7 +55,7 @@ value_cb - Description... + The result callback or &null;. @@ -55,7 +66,8 @@ &reftitle.returnvalues; - Description... + &return.success; + Use Memcached::getResultCode if necessary. @@ -67,14 +79,46 @@ addServer('localhost', 11211); + +$m->set('int', 99); +$m->set('string', 'a simple string'); +$m->set('array', array(11, 12)); + +$m->getDelayed(array('int', 'array'), true); +var_dump($m->fetchAll()); ?> ]]> - &example.outputs.similar; + &example.outputs; + array(3) { + ["key"]=> + string(3) "int" + ["value"]=> + int(99) + ["cas"]=> + float(2363) + } + [1]=> + array(3) { + ["key"]=> + string(5) "array" + ["value"]=> + array(2) { + [0]=> + int(11) + [1]=> + int(12) + } + ["cas"]=> + float(2365) + } +} ]]> @@ -85,7 +129,9 @@ &reftitle.seealso; - Classname::Method + Memcached::getDelayedByKey + Memcached::fetch + Memcached::fetchAll diff --git a/reference/memcached/memcached/getdelayedbykey.xml b/reference/memcached/memcached/getdelayedbykey.xml index b9875f8e27..418e361a47 100644 --- a/reference/memcached/memcached/getdelayedbykey.xml +++ b/reference/memcached/memcached/getdelayedbykey.xml @@ -1,23 +1,26 @@ - + Memcached::getDelayedByKey - The getDelayedByKey purpose + Request multiple items from a specific server &reftitle.description; - public voidMemcached::getDelayedByKey + public boolMemcached::getDelayedByKey stringserver_key arraykeys - stringwith_cas - stringvalue_cb + boolwith_cas + callbackvalue_cb - The method description goes here. + Memcached::getDelayedByKey is functionally equivalent to + Memcached::getDelayed, except that the free-form + server_key can be used to map the + keys to a specific server. @@ -29,7 +32,7 @@ server_key - Description... + The key identifying the server to request the items from. @@ -37,7 +40,7 @@ keys - Description... + Array of keys to request. @@ -45,7 +48,7 @@ with_cas - Description... + Whether to request CAS token values also. @@ -53,7 +56,7 @@ value_cb - Description... + The result callback or &null;. @@ -64,29 +67,8 @@ &reftitle.returnvalues; - Description... - - - - - &reftitle.examples; - - - <function>Memcached::getDelayedByKey</function> example - - -]]> - - &example.outputs.similar; - - - - + &return.success; + Use Memcached::getResultCode if necessary. @@ -94,7 +76,9 @@ &reftitle.seealso; - Classname::Method + Memcached::getDelayed + Memcached::fetch + Memcached::fetchAll