Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nick 101 posts 123 karma points
    May 19, 2014 @ 17:05
    Nick
    0

    Force Dictionary cache refresh

    Hello,

    As you know Courier 2 struggles with Dictionary items. It transfers them fine but the targer cache is not picking up the change. So far the only way to get the change to show is an application pool refresh or a log-out and re log-in.

    As a result I am trying to implement a button that will force a refresh. 

    I have written something like this:

      protected void btnRefresh_Click(object sender, EventArgs e)
            {
                try
                {
                    var dictionaryRefresher = new Guid(DistributedCache.DictionaryCacheRefresherId);
                    DistributedCache.Instance.RefreshAll(dictionaryRefresher);
                    //HttpRuntime.UnloadAppDomain();
                    txtResult.Text = "Dictionary cache succesfully refreshed.";
                }
                catch (Exception ex)
                {
                    txtResult.Text = "Error while refreshing dictionary cache: " + ex.Message;
                }
            }

     

    This, promissing though it looks, seems to do nothing.

    I am tempted to try "HttpRuntime. UnloadDomain()" which refreshes the app pool but that would mean the website would slow down everytime someone presses that refresh button so I don't think that's a good idea.

    Does anyone have a way to get the Dictionary to pick up the changes?
    If so please share. 

    Thank you

Please Sign in or register to post replies

Write your reply to:

Draft