I have a relatively large production site that uses some custom views to filter by taxonomys and other factors through dropdowns. I have come across the issue that adding a new taxonomy does not allow it to appear in these dropdowns until the cache has been cleared.
I have had a read around and it seems like the most specific thing to do would be to locate the cache tags for these views and invalidate them on creation of a new taxonomy term. However this could be quite complex for me and I was hoping there would be something like cache_clear_all('*', 'cache_view', TRUE);
from Drupal 7 so I could just rebuild by views cache when in a hook but this doesn't seem to be the case.
I have come across the D8 drupal_flush_all_caches()
method however this appears to clear and rebuild ALL caches with no options to limit its effect. My first question is, what would be the performance effect on my site if I used hook_cron
to flush all caches every ~3 hours? Would it be noticeable for the users?
Also, if anyone has a D8 method for clearing specific caches for views/custom blocks etc. I would love to hear them?
taxonomy_term_list
for this. This tag gets invalidated on all CRUD operations, also when a taxonomy term is added.