omz13 / kirby3-xmlsitemap

kirby3 plugin to generate an xml-based sitemap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cache name with major version

bnomei opened this issue · comments

when implementing a cache consider giving the file a name including the major version of your plugin. this will allow you to devalidate the cache on major version changes automatically.

$cachename = 'sitemap-' . kirby()->plugin('omz13/kirby3-xmlsitemap')->version()[0];
kirby->cache('omz13.kirby3-xmlsitemap')->set($cachename, $sitemapString);

In 0.4, I have implemented caching using the plugin cache facility (see the Cache Concepts document on notion)... the namespace is set automatically by kirby (so perhaps kirby should include the plugins version number)... but, just in case, I prefix a few parameters to the name when saving the page to the cache... in the next version I will add a bit more - to effectively cache bust vis-à-vis the options...

$cacheCache = kirby()->cache('omz13.xmlsitemap');
$cacheName = XMLSITEMAP_VERSION . '-sitemap-' . static::$optionCACHE;
if ($debug) {
$cacheName .= '-d';
}