I've been looking around and can't seem to find anything, maybe it's not possible.
For a forum plugin I'm toying with, topics use more data outside of the page in craft's db, so I need a way to bust the cache as craft won't be able to detect a change. So is there a way to 'bust' the Craft Cache possibly with a variable? I'd love to be able to do something like:
{% set param = craft.request.getParam( 'newreply' ) %}
{% cache globally using key craft.request.path until param == '1' %}
{# generated page content #}
{% endcache %}
This way it'd stay cached until the page was requested with ?newreply=1
, effectively busting the cache.
This doesn't seem to be working though. Does anyone have any ideas how this could be accomplished? If not possible with twig, would there be a way to do it in a plugin?
For example, what if I did something like:
{# twig template #}
{{ craft.myplugin.clearcache( craft.request.path ) }}
{# MyPluginVariable.php #}
public function clearcache($pageid)
{
craft()->templateCache->deleteCacheById($pageid);
return true;
}
That doesn't seem to do anything though
until
value to a time in the past? Something likenow|date_modify("-1 day")
{% cache globally using key craft.request.path ~ '?' ~ craft.request.queryString %}