bernhard Posted February 3, 2015 Share Posted February 3, 2015 Current options For a new project going online very soon i would need an option "clear cache for the saved page and its children". should not be that complicated to implement? i'm wondering why this is not already built in - didn't this need come up before? use-case: i have a catalog-like site structure. for every page i have a point of contact (POC) to choose. if nothing is chosen, it will show the POC of the parent page (recursively). that way i can define POCs for whole sections at once - with the only problem that when caching is turned ON and the client changes the POC of one category the POC will still remain on the cached children maybe anyone can point me to the right direction for hooking or forking this request on github? thanks Link to comment Share on other sites More sharing options...
cstevensjr Posted February 3, 2015 Share Posted February 3, 2015 My version of ProCache looks different from yours Edit: Please disregard, it seems you are not working with ProCache 1 Link to comment Share on other sites More sharing options...
bernhard Posted February 4, 2015 Author Share Posted February 4, 2015 nice to know that procache has this option steven thank you 1 Link to comment Share on other sites More sharing options...
bernhard Posted February 11, 2015 Author Share Posted February 11, 2015 i created a little module that does the trick, maybe it's helpful for anybody else: https://github.com/BernhardBaumrock/ProcessWireModules/blob/master/ClearCacheForDescendants.module does the "clear cache for children" option of procache clear only children pages or all the descendants? Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 11, 2015 Share Posted February 11, 2015 A small improvement would be using the saveReady hook, as it's fired after the to-be-saved data are checked for errors. 1 Link to comment Share on other sites More sharing options...
bernhard Posted February 11, 2015 Author Share Posted February 11, 2015 thank you! updated Link to comment Share on other sites More sharing options...
kongondo Posted February 11, 2015 Share Posted February 11, 2015 (edited) Cool.... Wondering though, what if a page has 1000s of descendants? That find could choke up.... Edited February 11, 2015 by kongondo 1 Link to comment Share on other sites More sharing options...
bernhard Posted February 11, 2015 Author Share Posted February 11, 2015 that's true but will not be the case in my project. any better ideas for solving my usecase from the first post? Link to comment Share on other sites More sharing options...
bernhard Posted April 9, 2015 Author Share Posted April 9, 2015 great news! this feature is now in the core - and you can guess, ryans solution is far better than my initial module https://processwire.com/blog/posts/processwire-core-updates-pull-requests-and-more-2.5.25/#clear-page-cache-by-matching-pages-with-custom-selector again a great example of how processwire evolves from the needs of every single user. thank you teppo for taking this further! edit: how would i set the "has_parent" id to page id of the page that is being saved? 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