This file contains hidden or 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
class EPiServerAwareKeyBuilder : IKeyBuilder | |
{ | |
private readonly IKeyBuilder _keyBuilder = new KeyBuilder(); | |
public string BuildKey(string controllerName) | |
{ | |
return this._keyBuilder.BuildKey(controllerName); | |
} | |
public string BuildKey(string controllerName, string actionName) |
This file contains hidden or 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
public class ContentDonutOutputCacheAttribute : DonutOutputCacheAttribute | |
{ | |
public ContentDonutOutputCacheAttribute() | |
: base(new KeyGenerator(new EPiServerAwareKeyBuilder()), new OutputCacheManager(OutputCache.Instance, new EPiServerAwareKeyBuilder()), (IDonutHoleFiller)new DonutHoleFiller((IActionSettingsSerialiser)new EncryptingActionSettingsSerialiser((IActionSettingsSerialiser)new ActionSettingsSerialiser(), (IEncryptor)new Encryptor())), (ICacheSettingsManager)new CacheSettingsManager(), (ICacheHeadersHelper)new CacheHeadersHelper()) | |
{ | |
} | |
} |
This file contains hidden or 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
public void StartListen() | |
{ | |
//Bind our local publish events | |
DataFactory.Instance.PublishedContent += (sender, args) => this.PurgeOutputCacheByContent(args.Content); | |
//More code comes here in later snippet... | |
} |
This file contains hidden or 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
public void StartListen() | |
{ | |
//Bind our local publish events | |
DataFactory.Instance.PublishedContent += (sender, args) => this.PurgeOutputCacheByContent(args.Content); | |
if (!this._eventRegistry.Enabled) | |
return; | |
//Finding the event for EPiServers RemoteCacheSynchronization-RemoveFromCache |
This file contains hidden or 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
//We are only listening to. | |
private static IEnumerable<string> RemoteEventPatterns = new List<string>() | |
{ | |
"EPLanguageData:([0-9]+)$", | |
"EP:ContentVersion:([0-9]+)$", | |
@"EPContentVersion:([0-9_]+)$" | |
}; | |
private void ChangeEventOnRaised(object sender, EventNotificationEventArgs eventNotificationEventArgs) | |
{ |
This file contains hidden or 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
void PurgeOutputCacheByContent(IContent content) | |
{ | |
IEnumerable<TemplateModel> templateModels = this._templateModelRepository.List(content.GetOriginalType()); | |
RouteValueDictionary routeValues = new RouteValueDictionary(); | |
routeValues.Add("currentcontent", content); | |
foreach (TemplateModel model in templateModels) | |
{ |
This file contains hidden or 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._query = this._query.For(searchQuery) | |
.InField((content) => content.Title) //Include important field | |
.AndInField((content) => content.MainBody) //Include important field | |
.AddMatchingQueryStringFor(searchQuery, (content) => content.SupportingText) //Inclue non-important field and require that all words are within |
This file contains hidden or 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._query = this._query.For(searchQuery) | |
.InField((content) => content.Title) //Include important field | |
.AndInField((content) => content.MainBody) //Include important field |
This file contains hidden or 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
public static IQueriedSearch<T> AddMatchingQueryStringFor<T>(this ITypeSearch<T> search, string queryString, Expression<Func<T, string>> fieldSelector) | |
{ | |
var fieldName = search.Client.Conventions.FieldNameConvention | |
.GetFieldNameForAnalyzed(fieldSelector); | |
//Split words by space | |
string[] words = queryString.Split(' '); | |
return new Search<T, WildcardQuery>(search, context => | |
{ |
This file contains hidden or 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
"bool":{ | |
"must":[ | |
{ | |
"query_string":{ | |
"fields":[ | |
"PageTitle$$string.standard", | |
"MainBody$$string.standard" | |
], | |
"query":"Manage On-Premise License", | |
"default_operator":"AND" |
OlderNewer