Skip to content

Commit 37947f6

Browse files
author
Warren Buckley
committed
Whitespace mess fixed up
1 parent e7ec903 commit 37947f6

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

Our.Umbraco.TagHelpers/UmbracoCacheTagHelper.cs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,62 @@
99

1010
namespace Our.Umbraco.TagHelpers
1111
{
12-
/// <summary>
13-
/// A wrapper around .net core CacheTagHelper so you remember not to cache in preview or Umbraco debug mode
14-
/// Also can create a new variance of the cache when anything is published in Umbraco if that is desirable
15-
/// </summary>
16-
[HtmlTargetElement("our-cache")]
17-
public class UmbracoCacheTagHelper : CacheTagHelper
12+
/// <summary>
13+
/// A wrapper around .net core CacheTagHelper so you remember not to cache in preview or Umbraco debug mode
14+
/// Also can create a new variance of the cache when anything is published in Umbraco if that is desirable
15+
/// </summary>
16+
[HtmlTargetElement("our-cache")]
17+
public class UmbracoCacheTagHelper : CacheTagHelper
1818
{
19-
private readonly IUmbracoContextFactory _umbracoContextFactory;
20-
private readonly IUmbracoTagHelperCacheKeys _cacheKeys;
19+
private readonly IUmbracoContextFactory _umbracoContextFactory;
20+
private readonly IUmbracoTagHelperCacheKeys _cacheKeys;
2121

22-
/// <summary>
23-
/// Whether to update the cache key when any content, media, dictionary item is published in Umbraco.
24-
/// </summary>
25-
public bool UpdateCacheKeyOnPublish { get; set; } = true;
22+
/// <summary>
23+
/// Whether to update the cache key when any content, media, dictionary item is published in Umbraco.
24+
/// </summary>
25+
public bool UpdateCacheKeyOnPublish { get; set; } = true;
2626

27-
public UmbracoCacheTagHelper(CacheTagHelperMemoryCacheFactory factory,
28-
HtmlEncoder htmlEncoder,
29-
IUmbracoContextFactory umbracoContextFactory,
30-
IUmbracoTagHelperCacheKeys cacheKeys)
31-
: base(factory, htmlEncoder)
32-
{
33-
_umbracoContextFactory = umbracoContextFactory;
34-
_cacheKeys = cacheKeys;
35-
}
27+
public UmbracoCacheTagHelper(CacheTagHelperMemoryCacheFactory factory,
28+
HtmlEncoder htmlEncoder,
29+
IUmbracoContextFactory umbracoContextFactory,
30+
IUmbracoTagHelperCacheKeys cacheKeys)
31+
: base(factory, htmlEncoder)
32+
{
33+
_umbracoContextFactory = umbracoContextFactory;
34+
_cacheKeys = cacheKeys;
35+
}
3636

37-
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
38-
{
39-
using (UmbracoContextReference umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext())
40-
{
41-
var umbracoContext = umbracoContextReference.UmbracoContext;
37+
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
38+
{
39+
using (UmbracoContextReference umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext())
40+
{
41+
var umbracoContext = umbracoContextReference.UmbracoContext;
4242

43-
// we don't want to enable the cache tag helper if Umbraco is in Preview, or in Debug mode
44-
if (umbracoContext.InPreviewMode || umbracoContext.IsDebug)
45-
{
46-
// Set the endabled flag to false & lest base class
47-
// of the cache tag helper do the same stuff as before
48-
this.Enabled = false;
49-
}
50-
else
51-
{
52-
// Defaults to true - have to explicitly opt out with attribute set to false in Razor
53-
if (UpdateCacheKeyOnPublish)
54-
{
43+
// we don't want to enable the cache tag helper if Umbraco is in Preview, or in Debug mode
44+
if (umbracoContext.InPreviewMode || umbracoContext.IsDebug)
45+
{
46+
// Set the endabled flag to false & lest base class
47+
// of the cache tag helper do the same stuff as before
48+
this.Enabled = false;
49+
}
50+
else
51+
{
52+
// Defaults to true - have to explicitly opt out with attribute set to false in Razor
53+
if (UpdateCacheKeyOnPublish)
54+
{
5555
// So before we go into our base class
5656
// Grab the cache key so we can keep track of it & put into some dictionary or collection
5757
// and clear all items out in that collection with our notifications on publish
5858

5959
var cacheKey = new CacheTagKey(this, context);
6060
var key = cacheKey.GenerateKey();
6161
var hashedKey = cacheKey.GenerateHashedKey();
62-
_cacheKeys.CacheKeys.TryAdd(key, cacheKey);
62+
_cacheKeys.CacheKeys.TryAdd(key, cacheKey);
6363
}
64-
}
64+
}
6565

6666
await base.ProcessAsync(context, output);
6767
}
68-
}
69-
}
68+
}
69+
}
7070
}

0 commit comments

Comments
 (0)