namespace
(defaults to "UserAgent") parameter defines the cache section used for this agent.
my $cache = Foswiki::Contrib::CacheContrib::getCache("ImagePlugin");
Foswiki::Func::getExternalResource()
with just adding caching.
It basically is compatible with LWP::UserAgent::get
.
Usage:
my $response = Foswiki::Contrib::CacheContrib::getExternalResource($url); throw Error::Simple("http error fetching $url: ".$response->code." - ".$response->status_line) unless $response->is_success; my $content = $response->decoded_content();
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
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:
cd /path/to/foswiki perl tools/extension_installer <NameOfExtension> installIf 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.
Name | Version | Description |
---|---|---|
LWP::UserAgent | >=0 | Required |
CHI | >=0 | Required |
19 Dec 2024 | improved defaults and config specs |
02 Feb 2023 | only http and https protocols are allowed fetching external resources |
27 Apr 2022 | add support for multiple namespaces and cache agents; improve handling of per cache expiry parameters |
14 Oct 2020 | initial release |
Author | Michael Daum |
Version | 3.21 |
Release | 19 Dec 2024 |
Description | Caching services for Foswiki extensions |
Repository | https://github.com/foswiki/CacheContrib |
Copyright | 2020-2024, Michael Daum, All Rights Reserved |
License | GPL (GNU General Public License) |
Home | http://foswiki.org/Extensions/CacheContrib |
Support | http://foswiki.org/Support/CacheContrib |
![]() |
© 2025 D.Soost & D.Marxsen - All rights reserved © Of all articles by authors Trademarks are the property of their respective owners © Logo by Wikipedia, modified by Administrator | Impressum Disclaimer Datenschutzerklärung |