Hi, I’m working on my first grav website http://www.weinfest-malans.ch - so far a really pleasant process - but now I’m wondering if there’s a possibility to create the cached images directly after an update and not when the page is opened for the first time. In this case there’s always an Error “grav.CRITICAL: Allowed memory size of 134217728 bytes exhausted…” and I have to refresh the page many times until the cached images are created.
The plugin precache isn’t so far a help. “grav.WARNING: precache: /home  ” are written in the error.log. Shoudn’t there be some elements in the array?
The Precache plugin probably needs a little attention.
I think that it should be possible to create a CLI command that causes the images to be cached. This is something I’ve had on my list of things to look at for some time. Just not gotten to it yet. It just involves getting all the pages together and calling their content() methods, like the pre-cache does. This will automatically create the images as needed.
bin/grav help clear
--all If set will remove all including compiled, twig, doctrine caches
--assets-only If set will remove only assets/*
--images-only If set will remove only images/*
--cache-only If set will remove only cache/*
Unfortunately the no-modifier version is called when doing an update. I think perhaps there is room to to pass in cache clear modifiers to the update process so you can define how the cache is cleared, but that is currently not there yet.
The plugin has, to my knowledge, not been rewritten for optimized processing. The problem is that it goes page by page and processes images as they appear, rather than spreading resources out and doing so in parallel. You end up trying to cache large resources that should not be processed together, and the system crashes itself.
Until a different approach to this caching is available, there’s always the option of not caching images through Grav but presenting them as is in templates.