cvs: peardoc /en/package/webservices/xml-rpc2 intro.xml
| From: | Fabien MARTY | Date: | Mon, 13 Feb 2006 23:15:55 +0000 |
| Subject: | cvs: peardoc /en/package/webservices/xml-rpc2 intro.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-7510@lists.php.net to get a copy of this message | ||
fab Mon Feb 13 23:15:55 2006 UTC
Modified files:
/peardoc/en/package/webservices/xml-rpc2 intro.xml
Log:
end of this first draft of the introduction
http://cvs.php.net/viewcvs.cgi/peardoc/en/package/webservices/xml-rpc2/intro.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/en/package/webservices/xml-rpc2/intro.xml
diff -u peardoc/en/package/webservices/xml-rpc2/intro.xml:1.2
peardoc/en/package/webservices/xml-rpc2/intro.xml:1.3
--- peardoc/en/package/webservices/xml-rpc2/intro.xml:1.2 Sun Feb 12 22:29:32 2006
+++ peardoc/en/package/webservices/xml-rpc2/intro.xml Mon Feb 13 23:15:55 2006
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="package.webservices.xml-rpc2.intro">
<refnamediv>
@@ -229,7 +229,50 @@
<refsect1 id="package.webservices.xml-rpc2.intro.examplecachedserver">
<title>A first example of the server side use (with integrated cache)</title>
<para>
- TO BE WRITTEN
+ As the caching process is completely transparent, this is very similar to the standard server
side use :
+ <programlisting role="php">
+ <![CDATA[
+ <?php
+
+require_once 'XML/RPC2/CachedServer.php';
+
+// Let's define a class with public static methods
+// PHPDOC comments are really important because they are used for automatic
+// signature checking
+
+// IMPORTANT : note the @xmlrpc.caching PHPDOC tags to indicate that the method has to be cached
+
+class EchoServer {
+
+ /**
+ * echoes the message received
+ *
+ * @param string Message
+ * @return string The echo
+ * @xmlrpc.caching true
+ */
+ public static function echoecho($string) {
+ return $string;
+ }
+
+}
+
+$options = array(
+ 'prefix' => 'test..',
+ 'cacheDebug' => false, // with cacheDebug set to true, it's very easy to get
an indication about the cache using (or not)
+ 'cacheOptions' => array(
+ 'cacheDir' => '/tmp/',
+ 'lifetime' => 3600,
+ 'cacheByDefault' => false // we don't cache by default (only methods with
@xmlrpc.caching true)
+ )
+);
+
+$server = XML_RPC2_CachedServer::create('EchoServer', $options);
+$server->handleCall();
+
+?>
+ ]]>
+ </programlisting>
</para>
</refsect1>
</refentry>