Skip to main content
added 278 characters in body
Source Link
andrew.welch
  • 11.6k
  • 24
  • 31

I have a plugin that renders HTML via a hook. If someone wraps that hook with {% cache %} in their templates, how can my plugin tell Craft to invalidate the cache when something within it changes?

EDIT: Let's say, for example, that I'm getting JSON data from an external source via my plugin. I could be rendering this via a hook, or using a Variable, it doesn't matter that much.

There's no Element that the content that changes can be linked to, in order to invalidate the cache.

I have a plugin that renders HTML via a hook. If someone wraps that hook with {% cache %} in their templates, how can my plugin tell Craft to invalidate the cache when something within it changes?

I have a plugin that renders HTML via a hook. If someone wraps that hook with {% cache %} in their templates, how can my plugin tell Craft to invalidate the cache when something within it changes?

EDIT: Let's say, for example, that I'm getting JSON data from an external source via my plugin. I could be rendering this via a hook, or using a Variable, it doesn't matter that much.

There's no Element that the content that changes can be linked to, in order to invalidate the cache.

Source Link
andrew.welch
  • 11.6k
  • 24
  • 31

Invalidating the cache tag from a plugin?

I have a plugin that renders HTML via a hook. If someone wraps that hook with {% cache %} in their templates, how can my plugin tell Craft to invalidate the cache when something within it changes?