How to clear twig cache by key?

mattcdavis1 - 1 month ago

Craft CMS has a deleteCacheById() method but not sure what Pyro has. I suppose this would be a non-issue if the database driver worked but in the meantime is there currently a way to clear cache by key?

ryanthompson - 1 month ago

Can you explain "if the database driver worked"? There is no cache clearing by key within the twig template. You could try flushCache is all.. or are you referring to Twig specific cache and not model bound cache?

mattcdavis1 - 1 month ago

{% cache 'my-cache-key' 9000 %}
    {% include '' ~ layout %}
{% endcache %}

How would i clear just "my-cache-key" from twig cache?

Now that the database driver is working, i can just run a SQL query to delete this entry but wan't sure if there was a way to do this through twig like Craft has ("deleteCacheById()")

BTW - there is some funky parsing going on with these forum comments. if i use backticks at any point after my first set of backticks it throws in a bunch of content from another area in my comment.