-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better hdd cache invalidation #71
Conversation
Hi @Syberspace, Thanks again, sorry if it takes some days until I have a closer look. |
Hi @Syberspace, But maybe, do you have an idea on how to detect orphaned directories while clearing a directory non-recursivly? This would be an awesome advancement, I think. |
Maybe it would be possible to set up a wp cron for every directory that is to be deleted using url_to_postid. Anything that returns no postid could be safely deleted. The reason for using wp cron is to keep the user's workflow uninterrupted if scanning a directory recursively has a negative impact on performance. If the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is fine, but please note the codex, a blank after a (
, also before closing bracket )
, also after the if
, before the open bracket if (
.
The cron is a good idea. I think for now, it works fine and we can merge it, since it is a very nice enhancement. If we run into problems, we can consider a cron or another method to clean up. Thank you again for this thoughtful PR! |
@bueltge thanks for the hint about formatting. should i update this pull to fix the formatting or are you gonna do that when you merge? |
@Syberspace yes, please a small update of this request, the fastest ways to solve this. Thanks a lot. |
@Syberspace |
Assume
_cachify_remove_post_type_cache_on_update
is set to 1 (only clear page cache) for the current user.This pull fixes the issue that
_clear_dir
deletes everything that's heirarchically below the post that is being saved.This problem would also happen for any other hierarchical post type where any parent also invalidates all it's children's cache.
The tradeoff with my implementation is that one might find orphaned directories in their cache directory.
For example saving the page with permalink
/test/
would leave an empty directory ofcache/cachify/<hostname>/test/
The other caching methods might need a similar fix, I haven't checked those out.