Quantcast
Channel: WPF Localization Extension
Viewing all articles
Browse latest Browse all 286

Closed Feature: Disable cache option and cache clean [9310]

$
0
0
Hi,

I am fighting with the same problem - I see that there is a cache used, which is kind of problem when I use my own provider. I implemented my own provider to support more things then just culture - in my case customers and cultures.

I would like to ask you if there is a way to:
a. disable the cache completly
or
b. clear cache on demand.

so far after some investigation of the code I come with this solution that seems to work, but is kind of hacky. Is there another clean way by design to refresh cache and update values in UI? Thx very much for this great project and your help!

My hacky solution: in my custom-provider is a method:

public void TriggerRefresh()
{
this.ValueChanged(this, new ValueChangedEventArgs(string.Empty, null, null));
}

this will cause to go through all keys in LocExtension.cs and removes them:

foreach (var cacheKey in ResourceBuffer.Keys)
{
if (cacheKey.EndsWith(args.Key))
{
if (ci == null || cacheKey.StartsWith(ci.Name))
{
if (ResourceBuffer[cacheKey] != args.Value)
{
keysToRemove.Add(cacheKey);
}
}

}
}


Viewing all articles
Browse latest Browse all 286


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>