currently translating
缓存
清理缓存
要强制重新缓存一个单独的页面,只要在 URL 中添加 purge
参数。例如:
http://www.example.com/namespace/page?purge=true
要强制重新缓存所有的页面,包括页面指令,可以执行 touch 2) 命令重新生成本地配置文件,conf/local.php
。
要强制重新缓存 xhtml 文件,执行 touch inc/parser/xhtml.php
。
两级缓存
DokuWiki uses two cache files per page. To understand this you need to know that a page is parsed to an intermediate instruction format first before it is rendered to XHTML. DokuWiki caches both – the instructions and the rendered XHTML.
位置
XHTML 和 指令缓存在 data/cache/*
路径下 6)。文件名以 .xhtml
,.i
结尾。其它文件也会保存了这个缓存目录下,包括:
.feed
— 为 wiki 生成的所有的 rss 源.code
— 启用高亮后,页面中<code> ... </code>
标签之间的部分
插件
Plugins can now influence cache use via the PARSER_CACHE_USE
event. This allows plugins which introduce additional dependencies for specific pages to check those dependencies and force DokuWiki to refresh the page when it wouldn't normally.
开发者说明
Up until now plugin developers have only been able to turn off caching completely. This has been necessary for plugins like discussion & include. To make use of the new functionality a syntax plugin will need to:
- save some information relating to the pages its involved with and the dependency specific to each of those pages. The page's metadata is a useful place for this. Metadata can be accessed via
$INFO['metadata']
and thep_get_metadata()
andp_set_metadata()
functions. If using metadata please try to stick to Dublin Core Metadata standards. - add an action_plugin component to handle the
PARSER_CACHE_USE
event.
Caching itself is handled by the cache object7). The key parts of that object of interest to plugins are:
- the
depends
array — DokuWiki fills this all the known dependencies of the page and then uses standard routines to process them. Plugins can add/modify these dependencies before they are processed. The different types of dependencies are:purge
— expire the cacheage
— expire the cache if its older than agefiles
— expire the cache if it is older than any of the files in this array. Only local files may be added.
- the cache name,
cache
— a unique identifier under which the cache is stored. Normally it is dependent on the page name,HTTP_HOST
and the server port. Plugins can generate more complex identifiers, e.g. the include generates identifiers using included page names and whether or not the current user has read access to those pages.