svn: /phpdoc/en/trunk/reference/varnish/ examples.xml
| From: | Anatoliy Belsky | Date: | Sun, 18 Sep 2011 14:40:00 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/varnish/ examples.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-8828@lists.php.net to get a copy of this message | ||
ab Sun, 18 Sep 2011 14:40:00 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=316932
Log:
added more basic usage examples
Changed paths:
U phpdoc/en/trunk/reference/varnish/examples.xml
Modified: phpdoc/en/trunk/reference/varnish/examples.xml
===================================================================
--- phpdoc/en/trunk/reference/varnish/examples.xml 2011-09-18 13:43:00 UTC (rev 316931)
+++ phpdoc/en/trunk/reference/varnish/examples.xml 2011-09-18 14:40:00 UTC (rev 316932)
@@ -2,7 +2,7 @@
<!-- $Revision$ -->
<chapter xml:id="varnish.examples" xmlns="http://docbook.org/ns/docbook">
&reftitle.examples;
- <section xml:id="varnish.example">
+ <section xml:id="varnish.example.admin">
<title>Basic VarnishAdmin usage</title>
<para>
The example illustrates a simple usage of the ban functionality
@@ -42,7 +42,7 @@
try {
$status = $va->ban('req.url ~ "^/$"');
- if (!VARNISH_STATUS_OK == $status) {
+ if (VARNISH_STATUS_OK != $status) {
throw new VarnishException("Ban method returned $status status\n");
}
} catch (VarnishException $e) {
@@ -56,6 +56,55 @@
</programlisting>
</example>
</section>
+ <section xml:id="varnish.example.stat">
+ <title>Basic VarnishStat usage</title>
+ <para>
+ The example illustrates getting varnish statistic snapshot from shared
+ memory
+ </para>
+ <example>
+ <title>Get statistic snapshot</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$vs = new VarnishStat;
+
+try {
+ $data = $vs->getSnapshot();
+} catch (VarnishException $e) {
+ echo $e->getMessage();
+ exit(3);
+}
+
+exit(0);
+]]>
+ </programlisting>
+ </example>
+ </section>
+ <section xml:id="varnish.example.log">
+ <title>Basic VarnishLog usage</title>
+ <para>
+ The example illustrates reading varnish log lines from shared memory
+ </para>
+ <example>
+ <title>Read varnish shared memory log</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$vl = new VarnishLog;
+while(1) {
+ $line = $vl->getLine();
+ printf("%s %d %s", VarnishLog::getTagName($line['tag'],
$line['id'],
+ $line['data']);
+}
+
+exit(0);
+]]>
+ </programlisting>
+ </example>
+ </section>
</chapter>
<!-- Keep this comment at the end of the file