Browse Source

fixed LUA code examples

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@464 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/heads/lighttpd-1.3.x
Jan Kneschke 17 years ago
parent
commit
2833c51fd8
  1. 50
      doc/cml.txt

50
doc/cml.txt

@ -102,13 +102,13 @@ and the following index.cml file: ::
b = request["DOCUMENT_ROOT"]
cwd = request["CWD"]
output_include = { b + "_cache.html" }
output_include = { b .. "_cache.html" }
trigger_handler = "index.php"
if file_mtime(b + "../lib/php/menu.csv") > file_mtime(cwd + "_cache.html") or
file_mtime(b + "templates/jk.tmpl") > file.mtime(cwd + "_cache.html")
file.mtime(b + "content.html") > file.mtime(cwd + "_cache.html") then
if file_mtime(b .. "../lib/php/menu.csv") > file_mtime(cwd .. "_cache.html") or
file_mtime(b .. "templates/jk.tmpl") > file.mtime(cwd .. "_cache.html")
file.mtime(b .. "content.html") > file.mtime(cwd .. "_cache.html") then
return 1
else
return 0
@ -144,13 +144,13 @@ The index.cml for this looks like: ::
cwd = request["CWD"]
output_include = { cwd + "head.html",
cwd + "menu.html",
cwd + "spacer.html",
cwd + "db-content.html",
cwd + "spacer2.html",
cwd + "news.html",
cwd + "footer.html" }
output_include = { cwd .. "head.html",
cwd .. "menu.html",
cwd .. "spacer.html",
cwd .. "db-content.html",
cwd .. "spacer2.html",
cwd .. "news.html",
cwd .. "footer.html" }
return 0
@ -159,8 +159,7 @@ Now we get about 10000 req/s instead of 600 req/s.
Installation
============
You need `lua <http://www.lua.org/>`_ and should install `<libmemcache-1.3.x http://people.freebsd.org/~seanc/libmemcache/>`
and have to configure lighttpd with: ::
You need `lua <http://www.lua.org/>`_ and should install `libmemcache-1.3.x <http://people.freebsd.org/~seanc/libmemcache/>`_ and have to configure lighttpd with: ::
./configure ... --with-lua --with-memcache
@ -211,28 +210,3 @@ What ever your script does, it has to return either 0 or 1 for ``cache-hit`` or
It case a error occures check the error-log, the user will get a error 500. If you don't like
the standard error-page use ``server.errorfile-prefix``.
Examples
========
Using the memcache-udf for MySQL we can do: ::
output_contenttype = "text/html"
output_include = { "cache-hit.html" }
trigger_handler = "generate.php"
if get["page"] == memcache_get_string("123") then
return 0
else
return 1
end
In MySQL you do: ::
SELECT memcache_set("127.0.0.1:11211", "123", "12");
or to retrieve a value: ::
SELECT memcache_get("127.0.0.1:11211", "123");
You can get the mysql udf at `jan's mysql page <http://jan.kneschke.de/projects/mysql/udf/>`_.

Loading…
Cancel
Save