TIP CacheContrib is not installed on Foswiki.org.


Caching services for Foswiki extensions


This package is used by other extensions in need of caching services. This specific cache stores data for a short period time, e.g. one day, for faster access in the meantime. Data might be any arbitrary perl data object which is serialized by the underlying cache implementation CHI - Unified cache handling interface.

CHI offers some interesting features such as multi-level caching, shared caching and distributed caching based on the configuration. It thus is suitable to share cached data among several Foswiki backends, either on the same host or in a distributed setup.

Perl API

Clearing and Purging the cache

The cache can be cleared or purged using a separate tool that is best installed as a cronjob to perform these maintenance steps offline on a regular base.

  • purgeCache: purge outdated cache entries as configured in the $Foswiki::cfg{CacheContrib}{CacheExpire} setting
  • clearCache: clear all of the cache independently of its expiry time
  • virtualhosts-pureCache, virtualhosts-clearCache: same scripts as above but to be used in a virtual hosting environment


CacheContrib implements a caching user agent ontop of the regular LWP::UserAgent. This can either be instanciated using the Foswiki::Contrib::CacheContrib::getUserAgent() api or by directly creating an object of the class Foswiki::Contrib::CacheContrib::UserAgent. The default caching namespace for both is UserAgent, that is all instances share the same cache. The UserAgent cache may be purged individually using the url parameter refresh=on or refresh=ua.

For convenience there is a caching variat of the standard API Foswiki::Func::getExternalResource available at Foswiki::Contrib::CacheContrib::getExternalResource which basically behaves the same but except:

  • uses proper proxy settings
  • uses LWP::UserAgent for any network interaction
  • uses caching

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.



Change History

14 Oct 2020 initial release

PackageForm edit

Author Michael Daum
Version 1.00
Release 14 Oct 2020
Description Caching services for Foswiki extensions
Copyright 2020, Michael Daum, All Rights Reserved
License GPL (GNU General Public License)
Home http://foswiki.org/Extensions/CacheContrib
Support http://foswiki.org/Support/CacheContrib
Repository https://github.com/foswiki/CacheContrib
ExtensionClassification Data and Files
ExtensionType ContribPackage
SupportUrl CacheContrib
ModificationPolicy CoordinateWithAuthor
Topic attachments
I Attachment Action Size Date Who Comment
CacheContrib.md5md5 CacheContrib.md5 manage 159 bytes 14 Oct 2020 - 10:09 MichaelDaum  
CacheContrib.sha1sha1 CacheContrib.sha1 manage 183 bytes 14 Oct 2020 - 10:10 MichaelDaum  
CacheContrib.tgztgz CacheContrib.tgz manage 7 K 14 Oct 2020 - 10:09 MichaelDaum  
CacheContrib.zipzip CacheContrib.zip manage 14 K 14 Oct 2020 - 10:09 MichaelDaum  
CacheContrib_installerEXT CacheContrib_installer manage 4 K 14 Oct 2020 - 10:09 MichaelDaum  
Topic revision: r1 - 14 Oct 2020, MichaelDaum - This page was cached on 16 Oct 2020 - 03:06.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy