TIP CacheContrib is not installed on Foswiki.org.

CacheContrib

Caching services for Foswiki extensions

Description

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

LWP::UserAgent

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.

Dependencies

NameVersionDescription
LWP::UserAgent>=0Required
CHI>=0Required

Change History

27 Apr 2022 add support for multiple namespaces and cache agents; improve handling of per cache expiry parameters
14 Oct 2020 initial release

PackageForm edit

Author Michael Daum
Version 3.00
Release 17 Mar 2022
Description Caching services for Foswiki extensions
Copyright 2020-2022, 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
Compatibility
IncompatibleWith
ImageUrl
DemoUrl http://
SupportUrl CacheContrib
ModificationPolicy CoordinateWithAuthor
I Attachment Action Size Date Who Comment
CacheContrib.md5md5 CacheContrib.md5 manage 159 bytes 27 Apr 2022 - 17:59 MichaelDaum  
CacheContrib.sha1sha1 CacheContrib.sha1 manage 183 bytes 27 Apr 2022 - 18:00 MichaelDaum  
CacheContrib.tgztgz CacheContrib.tgz manage 8 K 27 Apr 2022 - 17:59 MichaelDaum  
CacheContrib.zipzip CacheContrib.zip manage 15 K 27 Apr 2022 - 17:59 MichaelDaum  
CacheContrib_installerEXT CacheContrib_installer manage 4 K 27 Apr 2022 - 17:59 MichaelDaum  
Topic revision: r2 - 27 Apr 2022, MichaelDaum
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