@Krishnamurthy, Rajarajacholan (DG-CHN) Thank you for your patience.
After reviewing the code snippet, found that below code doesn't set Cache expiration only to key "Message" but instead it applies to the whole ConfigureRefresh (which includes Sentinel). Hence, any change in Sentinel or Message doesn't refresh the value until cache expiration time has met (1 day).
.ConfigureRefresh(refresh =>
{
// All configuration values will be refreshed if the sentinel key changes.
refresh.Register("TestApp:Settings:Sentinel", refreshAll: true);
refresh.Register("TestApp:Settings:Message").SetCacheExpiration(TimeSpan.FromDays(30));
})
For your case, you can change something like below:
.ConfigureRefresh(refresh =>
{
refresh.Register("Sentinel", refreshAll: true);
//refresh.SetCacheExpiration(TimeSpan.FromSeconds(30)); // optional as 30s is the default
})
.ConfigureRefresh(refresh =>
{
refresh.Register("Message");
refresh.SetCacheExpiration(TimeSpan.FromDays(1));
})
This way you can set SetCacheExpiration for different keys, and ConfigureRefresh will behave as you expected.
I hope this answers your question and feel free to add if you have any questions. I would be happy to assist you. Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community.