CachedMetadataPlugin

Provides a reusable API for loading cached metadata and preferences for all topics in a web.

API

From another plugin:

use Foswiki::Plugins::CachedMetadataPlugin::Core ();

my $cache = Foswiki::Plugins::CachedMetadataPlugin::Core::cached_metadata('Sandbox');

Cache behavior

The plugin stores metadata for a web in:

data/<web>/.cached_metadata.json

It validates the cache by comparing the cache file mtime to the newest topic file:

data/<web>/*.txt

If any topic text file is newer than the cache, the cache is rebuilt.

Locking

A lock file is used to prevent multiple concurrent rebuilds:

data/<web>/.cached_metadata.lock

Configuration

This plugin has configuration options available in configure, including:
  • whether disk caching is enabled
  • cache and lock file names
  • pretty-printed JSON output
  • rebuild logging
Topic revision: r2 - 09 Mar 2024, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback