I am using the following to clear view specific cache on node_presave
which is working fine.
cache_clear_all($view_name.':'.$display_name, 'cache_views_data', TRUE);
Currently, it is deleting all the views generated for all Contextual Filters(taxonomy term id). I want to be able to delete only the view for one taxonomy term id.
For example, if the node a with tid:46
is added,
What is happening:
All the following view's caches are cleared(deleted from cache_views_data table).
articles/45
articles/46
articles/47
What I want to happen:
only delete the view's cache for articles/46
.
So, to achieve this I started digging into the tables(mainly cache_views_data) to figure out the pattern of the CID.
There is a UUID like string added to each CID.
What I have known so far is: that this String seems to be the same for a particular view. For example, for the view articles/46
, it is the same each time. I have tried clearing the cache several times and re-generate it again and again.
I believe that if I can know the correct string for each view, I can clear the caches specifically.
So my question is: Is what I am trying to achieve doable? Does the string change based on some unknown factor? If not, is it consistent and dependable? If yes, then how can I know how and where is this generated?
My guess is that the views module
is using the ctools module
for this but I don't know how exactly.