Posted on 02/09/2021 16:39:25
Hi Kevin
The ProductService uses Dynamicweb.Caching.MemoryCache as you have found, and that uses Dynamicweb.Caching.CacheItemPolicy.DefaultStoragePolicy which looks like this:
new CacheItemPolicy { SlidingExpiration = new TimeSpan(0, 10, 0) };
So 10 minutes.
You might be able to override that by code the default policy is a static property that can be manipulated on application start and should last the duration of the application lifecycle - something like this (which I have not tested)
using Dynamicweb;
namespace Dynamicweb.Examples.Notifications.Standard
{
[Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Standard.Application.AfterDynamicwebStart)]
public class ApplicationStartObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
if (args == null)
return;
if (!(args is Dynamicweb.Notifications.Standard.Application.AfterDynamicwebStartArgs))
return;
Dynamicweb.Notifications.Standard.Application.AfterDynamicwebStartArgs item = (Dynamicweb.Notifications.Standard.Application.AfterDynamicwebStartArgs)args;
Dynamicweb.Caching.CacheItemPolicy.DefaultStoragePolicy.SlidingExpiration.Add(new System.TimeSpan(12, 0, 0));
}
}
}
Are you using the classic product catalog or are you using the product catalog for viewmodels? It might be possible to change the template in a way so the 15000 combinations does not load their product record - but only the surrounding information. But I will need to see some template code to check that.
BR Nicolai