gRegor Posted June 16, 2016 Share Posted June 16, 2016 I'm using "quiet" saving in the Webmention module and was wondering if that prevents the page's cache from being cleared. I'm just using the built-in page caching with the option "Clear cache for saved page only (default)" If it matters, the page-save I'm calling is specifying the Webmention Field, rather than just $page->save(); For reference, the code is https://github.com/gRegorLove/ProcessWire-Webmention/blob/master/Webmention/Webmention.module#L840 Link to comment Share on other sites More sharing options...
gRegor Posted June 17, 2016 Author Share Posted June 17, 2016 Bumping in case this was missed during forum upgrade. 1 Link to comment Share on other sites More sharing options...
apeisa Posted June 19, 2016 Share Posted June 19, 2016 I don't know what quiet save does, but isn't that cache question pretty fast to test? 1 Link to comment Share on other sites More sharing options...
Jan Romero Posted June 21, 2016 Share Posted June 21, 2016 Actually, I just experienced this “problem” where I’m saving an image field using $page->save('images') and even in non-quiet mode it didn’t invalidate the one-week template cache. That’s on a 2.7.2 installation. So the answer to your question seems to be Yes, it does prevent the cache from being cleared. I’m putting “problem” in quotes because I don’t really care one way or the other in this particular instance, but my user got confused (as always with caching). Link to comment Share on other sites More sharing options...
gRegor Posted June 22, 2016 Author Share Posted June 22, 2016 I was hoping for more explanation of quiet saving instead of just experimentation. I did just experiment though and it doesn't seem to clear the cache. It sounds like it's a bug based on that and Jan's report; I'll dig into core code. Link to comment Share on other sites More sharing options...
kongondo Posted June 22, 2016 Share Posted June 22, 2016 Explanation of quiet: https://processwire.com/api/ref/pages/save/ http://kongondo.github.io/ProcessWireAPIGen/dev/source-class-Pages.html 2 Link to comment Share on other sites More sharing options...
gRegor Posted June 22, 2016 Author Share Posted June 22, 2016 Thanks, @kongondo! I'd not seen those new reference pages. Link to comment Share on other sites More sharing options...
gRegor Posted July 5, 2016 Author Share Posted July 5, 2016 After more digging and experimenting, I found the functionality I was looking for is (a bit un-intuitively) in the PageRender module. There's methods in there that hook into Pages::save, get the CacheFile for the page, and clear it. Since the method clearCacheFile() is a hook call and not intended to be called directly, I ended up doing this in my module after saving fields: $PageRender = $this->wire('modules')->get('PageRender'); $cf = $PageRender->getCacheFile($page); if ( $cf->exists() ) { $cf->remove(); } Some of my earlier experimentation was calling $this->wire('cache')->maintenance(), but I realized that's WireCache which is different than the cached files created for pages. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now