General purpose cache that presents Foswiki topics as expanded hashes Useful for rapid read and search of the database. Only works on one web.
Typical usage:use Foswiki::Contrib::DBCacheContrib; $db = new Foswiki::Contrib::DBCacheContrib( $web ); # always done $db->load(); # may be always done, or only on demand when a tag is parsed that needs it # the DB is a hash of topics keyed on their name foreach my $topic ($db->getKeys()) { my $attachments = $db->fastget($topic)->fastget("attachments"); # attachments is an array foreach my $val ($attachments->getValues()) { my $aname = $attachments->fastget("name"); my $acomment = $attachments->fastget("comment"); my $adate = $attachments->fastget("date"); ... } }As topics are loaded, the readTopicLine method gives subclasses an opportunity to apply special processing to indivual lines, for example to extract special syntax such as %ACTION lines, or embedded tables in the text. See FormQueryPlugin for an example of this.
new($web, $cacheName[, $standardSchema ])
$web
name of web to create the object for.
$cacheName
name of cache file
$standardSchema
Set to 1 this will load the cache using the 'standard' Foswiki schema, rather than the original DBCacheContrib extended schema.
$topics
- perl array of topic names that have just been loaded (or reloaded)
Load the web into the database. Returns a list containing 3 numbers that give the number of topics read from the cache, the number read from file, and the number of previously cached topics that have been removed.
uptodate($topic, $time)
→ boolean parseDate($string)
→ epoch try as hard as possible to parse the string into epoch seconds