Hi @bezbeli
Thank you for using our plugin!
There are several cases in which a cache record could be cleared, clicking the Clear REST cache button is only one of them:
- When a users clicks the Clear REST cache button, in this case ALL caches are cleared
- When a new post/term is added, in this case all overview endpoints of this post type/taxonomy are cleared
- When a post/term is edited, in this case all caches that have this post/term in it are cleared
- When a post/term is deleted, in this case all caches that have this post/term in it are cleared
- …
- When a cache record is expired
Specifically this last case makes it hard to have a reliable hook for when a cache is cleared. Since we use the transient API, we have no way of detecting if/when a cache record expires. Furthermore, since there are several case in which only a part of the cache records are cleared, how would you want to handle this? Triggering a hook for each seperate cache record isn’t something we are very happy to do, since this would influence performance when adding/editing/deleting a post/term.
So if you are looking for a hook whenever the Clear REST cache button is clicked, that is something we could add. That is however as said not the only case in which caches are cleared and for the other cases it is a bit harder to have a good hook.