Custom cache prefix woes

Is it expected that custom caches are prefixed with a domain in /site/cache ?

E.g. I have a custom cache in a plugin and its location on the file system depends on where I access Kirby from:

  • When I visit the website from website.test it’s in /site/cache/mywebsite.test/bvdputte/pluginname
  • But when I visit from CLI (from a worker php file run by a cron job to flush it), kirby thinks it’s in site/cache/_/bvdputte/pluginname

I’ve also checked with echo $kirby->cache('bvdputte.myplugin.api")->root(); but it gives me the same 2 (different) roots like above…

Since those 2 locations doesn’t match, I cannot flush it, nor can I repopulate it?

Thanks

You can work around this by explicitely adding the URL to the config file:

"url" => "http://mywebsite.test"

Good to know, thanks for posting the answer here.