You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-3Lines changed: 37 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -357,15 +357,49 @@ Essentially this is a convenience for setting
357
357
'''
358
358
359
359
### Clearing the Cache 'on publish'
360
-
The DotNet CacheTagHelper really isn't designed to make it easy to clear the cache 'on command' it's designed to vary and then fall out of cache after a period of time, but what if you want your cache instantly refreshed when a publish takes place? This tag helper has the possibility to 'vary' the cache by the last Content/Media/Dictionary Cache Refresh date.
360
+
The DotNet CacheTagHelper really isn't designed to make it easy to clear the cache 'on command' it's designed to vary and then fall out of cache after a period of time, but what if you want your cache instantly refreshed when a publish takes place? This tag helper has the possibility to 'vary' the cache when a piece of content/media or dictionary is published.
361
361
362
362
'''cshtml
363
363
<our-cacheupdate-cache-key-on-publish="true">[Your Long Running Expensive Code Here]</our-cache>
364
364
'''
365
365
366
-
With this set to true any publish will trigger a new 'cache key' and therefore a fresh version of the TagOutput will be displayed, with this set, and if no ExpiresAfter is set on the Tag, we default to 24hrs as the lifetime of the Tag's cache.
366
+
With this set to true any publish will remove the item from a list of tracked cached items and therefore a fresh version of the TagOutput will be displayed.
367
367
368
-
This is set to True by default, how opinionated of us.
368
+
This is set to True by default, how opinionated of us, so you only need to explictly use the attrivute if you wish to set this to false and not clear the cache item on Umbraco content/media/dictionary publish.
369
+
370
+
### Examples
371
+
All examples will skip the cache for Umbraco preview mode and debug mode, and evicit cache items anytime Umbraco publishes content, media or dictionary items.
<!-- Need to clear cache when phone number changes on different node -->
395
+
</our-cache>
396
+
397
+
<our-cache>
398
+
<!-- Default of 20mins Global navigation -->
399
+
<!-- A global naviagtion need to clear cache when phone number changes on different node -->
400
+
<partial name="Navigation" />
401
+
</our-cache>
402
+
```
369
403
370
404
(NB if you had a thousand tag helpers on your site, all caching large amounts of content, and new publishes to the site occurring every second - this might be detrimental to performance, so do think of the context of your site before setting this value)
0 commit comments