Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hi,
I'm assuming you're using EPiServer 7<.
If you only need to update the list when content is published, you can listen to content repository events:
namespace DV
{
using EPiServer;
using EPiServer.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class EventsInitialization : IInitializableModule
{
private bool eventsAttached;
public void Initialize(InitializationEngine context)
{
if (!eventsAttached)
{
var repository = ServiceLocator.Current.GetInstance<IContentEvents>();
repository.PublishedContent += this.PublishedContent;
eventsAttached = true;
}
}
public void Preload(string[] parameters)
{
throw new NotImplementedException();
}
public void Uninitialize(InitializationEngine context)
{
repository.PublishedContent -= this.PublishedContent;
eventsAttached = false;
}
private void PublishedContent(object sender, ContentEventArgs e)
{
// Do your magic here.
}
}
Hi all,
I'm trying to maintain a hash table of episerver page ids to domain specific ids. The hash table uses the singleton pattern and is initially populated by running through the full list of pages. This mapping will need to be recreated however everytime the cache changes, say for example if a new piece of content is published.
My touble is I can't seem to find a way of detecting when the Episerver cache changes. No such change event appears to exists on the EPiServer.CacheManager class.
Does anybody have an idea of how I might detect such a cache change in episerver?
Regards,
Rich