Public TWiki sites are frequently visited by search engine spiders and non-authenticated users. The actual traffic by authenticated users who browse and change content is typically less than 5% of all traffic. This add-on is designed to cache topics for non-authenticated users. Content is not cached for authenticated users - this ensures that personalized content remains personalized.
A typical TWiki page may load in about 1 second. A cached topic loads about 10 times faster.
Deploying this add-on on a public TWiki site tends to speed up the site for all users. It also reduces the CPU load considerably on a high traffic site. On TWiki.org the average CPU load dropped from 2-3 down to 0.2-0.5 after deploying this add-on.
Once the add-on is installed and configured it can be forgotten, the caching and cache update is done automatically.
A topic is only cached if:
The cached content is returned if all conditions are met and if the cache exists. If needed, a topic is cached or re-cached first.
A configurable cache invalidation determines when a topic is re-cached. There are three tiers:
WebChanges, WebRss
: Cache invalidation is 1 hour by default.
WebHome, WebTopicList
: Cache invalidation is 6 hours by default.
Note: You do not need to install anything on the browser to use this add-on. The following instructions are for the administrator who installs the add-on on the TWiki server.
TWikiGuestCacheAddOn.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/TWikiGuestCacheAddOn.txt | Add-on topic |
bin/viewcache | View script with cache logic |
lib/TWiki/Contrib/TWikiGuestCacheAddOn.pm | Add-on Perl module |
lib/TWiki/Contrib/TWikiGuestCacheAddOn/Config.spec | Spec file for configure |
# Comma-space delimited list of topic names to exclude:
$TWiki::cfg{TWikiGuestCacheAddOn}{ExcludeTopics} = 'TWikiRegistration';
# Comma-space delimited list of tier 1 topic names:
$TWiki::cfg{TWikiGuestCacheAddOn}{Tier1Topics} = 'WebAtom, WebChanges, WebRss';
# Maximum cache age for tier 1 pages, in hours:
$TWiki::cfg{TWikiGuestCacheAddOn}{Tier1CacheAge} = '1';
# Comma-space delimited list of tier 2 topic names:
$TWiki::cfg{TWikiGuestCacheAddOn}{Tier2Topics} = 'WebHome, WebTopicList';
# Maximum cache age for tier 2 pages, in hours:
$TWiki::cfg{TWikiGuestCacheAddOn}{Tier2CacheAge} = '6';
# Maximum cache age for default pages, in hours:
$TWiki::cfg{TWikiGuestCacheAddOn}{CacheAge} = '48';
# Debug flag:
$TWiki::cfg{TWikiGuestCacheAddOn}{Debug} = 0;
twiki/bin/viewcache
script to twiki/bin/view
(overwrite the latter).
twiki/pub/.cache/<web>/<topic>.html
has been created.
twiki/data/log202506.txt
to verify that cached content is returned you should see "from cache"
entries. Example:| 2025-06-05 - 07:32 | guest | view | Support.SupportForum | Mozilla - from cache | 1.2.3.4 |
Add-on Author: | TWiki:Main.PeterThoeny![]() |
Copyright: | © 2009-2018 TWiki:Main.PeterThoeny![]() © 2009-2018 TWiki:TWiki.TWikiContributor ![]() |
License: | GPL (GNU General Public License![]() |
Add-on Version: | 2018-07-10 |
Change History: | |
2018-07-10: | TWikibug:Item7841![]() |
2016-01-13: | TWikibug:Item7708![]() |
2015-10-09: | TWikibug:Item7568![]() ![]() |
2015-04-28: | TWikibug:Item7627![]() |
2015-03-20: | TWikibug:Item7627![]() |
2013-10-25: | TWikibug:Item7371![]() |
2013-10-17: | TWikibug:Item7371![]() |
2013-07-01: | TWikibug:Item7154![]() |
2013-02-22: | TWikibug:Item7154![]() |
2013-02-22: | TWikibug:Item7154![]() |
2012-12-28: | TWikibug:Item7112![]() |
2012-12-22: | TWikibug:Item7094![]() |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.3 (TWiki-5.0) |
CPAN Dependencies: | none |
Other Dependencies: | none |
Perl Version: | 5.005 |
Add-on Home: | http://TWiki.org/cgi-bin/view/Plugins/TWikiGuestCacheAddOn![]() |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/TWikiGuestCacheAddOnDev![]() |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/TWikiGuestCacheAddOnAppraisal![]() |
Related Topic: TWikiAddOns