Use DistributedCache to send ICacheRefresher to Subscriber server not working
Hi everyone,
I have the use case which need to clean up RuntimeCache by using ICacheRefresher for all Subscriber servers. I tried on my local machine by setting up Subscriber and SchedulingPublisher via SQL Express, the code is worked. However, I deploy the code to real environment, it isn't working. The Subscriber server cannot subscribe the ICacheRefresher. I wonder it is because of TempFileSystemDirectoryFactory .
More info: I am suing Umbraco 11.3.1, Host by using EKS, Linux
Code to notify the ICacheRefresher
public class RuntimeCacheLoadBalancerRefresher : CacheRefresherBase<RuntimeCacheLoadBalancerRefresherNotification>
{
private readonly ILogger<RuntimeCacheLoadBalancerRefresher> _logger;
public static readonly Guid UniqueId = Guid.Parse("XXX-XXX");
public override string Name => "Runtime Cache Load Balancer Refresher";
public override Guid RefresherUniqueId => UniqueId;
public RuntimeCacheLoadBalancerRefresher(
AppCaches appCaches,
IEventAggregator eventAggregator,
ICacheRefresherNotificationFactory factory,
ILogger<RuntimeCacheLoadBalancerRefresher> logger)
: base(appCaches, eventAggregator, factory)
{
_logger = logger;
}
public override void RefreshAll()
{
_logger.LogInformation("Refresh RunTime Cache in the machine name {machineName}", Environment.MachineName);
AppCaches.RuntimeCache.Clear();
base.RefreshAll();
}
}
Noted: I use the explicit code to register the ServerRole in DI, by reading another option value.
Also, is it there any possible Umbraco service which support to boardcast the message? I only the keyword IServerMessager but i think it is already used within the DistributedCache class mechanism. Can i consider to use another technique Pub-Sub like RabbitMq to send the notification from BackOffice to Subscriber server?
Use DistributedCache to send ICacheRefresher to Subscriber server not working
Hi everyone,
I have the use case which need to clean up RuntimeCache by using ICacheRefresher for all Subscriber servers. I tried on my local machine by setting up Subscriber and SchedulingPublisher via SQL Express, the code is worked. However, I deploy the code to real environment, it isn't working. The Subscriber server cannot subscribe the ICacheRefresher. I wonder it is because of TempFileSystemDirectoryFactory .
More info: I am suing Umbraco 11.3.1, Host by using EKS, Linux
Code to notify the ICacheRefresher
Code to send
Subscriber server config
SchedulingPublisher server config
Noted: I use the explicit code to register the ServerRole in DI, by reading another option value.
Also, is it there any possible Umbraco service which support to boardcast the message? I only the keyword IServerMessager but i think it is already used within the DistributedCache class mechanism. Can i consider to use another technique Pub-Sub like RabbitMq to send the notification from BackOffice to Subscriber server?
Hope you help, Thanks
is working on a reply...