forked from OrchardCMS/Orchard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes IDisplayedContentItemHandler in favour of ICacheTagProvider (O…
…rchardCMS#7793) Fixes OrchardCMS#7792
- Loading branch information
1 parent
5ce43b6
commit 7373c11
Showing
6 changed files
with
29 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 5 additions & 8 deletions
13
...e/Handlers/DisplayedContentItemHandler.cs → ...dlers/DisplayedContentCacheTagProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Globalization; | ||
using System.Linq; | ||
using Orchard.OutputCache.Services; | ||
using Orchard.ContentManagement.Handlers; | ||
|
||
namespace Orchard.OutputCache.Handlers { | ||
/// <summary> | ||
/// Saves references to content items which have been displayed during a request | ||
/// Creates tags for content items which have been displayed during a request | ||
/// </summary> | ||
public class DisplayedContentItemHandler : ContentHandler, IDisplayedContentItemHandler { | ||
public class DisplayedContentCacheTagProvider : ContentHandler, ICacheTagProvider { | ||
private readonly Collection<int> _itemIds = new Collection<int>(); | ||
|
||
protected override void BuildDisplayShape(BuildDisplayContext context) { | ||
_itemIds.Add(context.Content.Id); | ||
} | ||
|
||
public bool IsDisplayed(int id) { | ||
return _itemIds.Contains(id); | ||
} | ||
|
||
public IEnumerable<int> GetDisplayed() { | ||
return _itemIds.Distinct(); | ||
public IEnumerable<string> GetTags() { | ||
return _itemIds.Distinct().Select(id => id.ToString(CultureInfo.InvariantCulture)); | ||
} | ||
} | ||
} |
4 changes: 0 additions & 4 deletions
4
src/Orchard.Web/Modules/Orchard.OutputCache/ICachingEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/Orchard.Web/Modules/Orchard.OutputCache/Services/ICacheTagProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Orchard.OutputCache.Services { | ||
public interface ICacheTagProvider : IDependency { | ||
IEnumerable<string> GetTags(); | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
src/Orchard.Web/Modules/Orchard.OutputCache/Services/IDisplayedContentItemHandler.cs
This file was deleted.
Oops, something went wrong.