I created a cutom cache with getCache for a json resource generated with a time-consuming snippet/query.
[[!getCache?
&element=`jsonquery`
&cacheExpires=`0`
&cacheKey=`nightrun`
&cacheElementKey=`nightrun`
]]
How may I write a cron file in order to rebuild the custom json cache every nights?
The following 'refresh' method doesn't really rebuild the custom cache but delete it : the cache will be rebuild next time the resource will be called :
$modx->cacheManager->refresh(array(
'nightrun' => array()
));
It's why I'd like to write a cron job to tell to modx : rebuild the custom getCache/cacheKey 'nightrun' cache every nights?
Help welcome
MODX lover
-
Développeur MODX / Webdesign / Solutions web
The RefreshCache snippet has a 'cron' branch at GitHub. It should run as a cron job to refresh all resources on the site using cURL.
https://github.com/BobRay/RefreshCache/tree/cron
Let me know if it works for you.
cURL works fine but I've had to disable xFPC extra on my test MODX site to get the expected result.
@BobRay; I missed that, I'll test it!
Thanks!
MODX lover
-
Développeur MODX / Webdesign / Solutions web