Copied to clipboard

Flag this post as spam?

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


  • Jamie Attwood 207 posts 501 karma points c-trib
    Sep 09, 2015 @ 20:16
    Jamie Attwood
    0

    Updating target dictionary items does not work unless you restart the app pool

    Courier 2.50.1 updating target dictionary items does not work unless you restart the app pool.

    I have seen some old posts on this, and I know the dictionary items are cached in memory, but is there a config setting or something that we can use or add for future that will trigger an app pool refresh after the transfer of a dictionary item?

    Alternately, can you suggest an different method of updating remote dictionary items that would not involve a developer touching web.config or restarting the app pool?

    Any help appreciated.

    Thanks,

    Jamie

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Sep 26, 2015 @ 00:12
    Marc Goodson
    0

    Umbraco 7.3 I believe will introduce the ability to call:

    ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<IDictionaryItem>();
    

    So you may find this will begin to work in the accompanying version of Courier.

    In the meantime If you create a new dictionary item on the target site, of any content, it will break the entire dictionary item cache, and your new items will appear, without performing an app pool recycle.

    With the 'cloud umbraco cache refresh' project I do this workaround/hack in code:

     private void RefreshDictionaryCache(Guid publishId )
            {
                //currently the hashtable that contains the cache of dictionary items in memory
                // only gets cleared when new items are added or removed
                // there isn't the function to clear the cache
                // this is coming in 7.3
               //ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<IDictionaryItem>();
              // so it would be a horrible hack here to temporarily create / update an existing DictionaryItem called "TempRefreshCache"...
                // .... apologies
                var ls = ApplicationContext.Current.Services.LocalizationService;
                if (!ls.DictionaryItemExists("TempRefreshCache"))
                {
                    DictionaryItem newItem = new DictionaryItem("TempRefreshCache");
                    foreach (var translation in newItem.Translations)
                    {
                        translation.Value = publishId.ToString();
                    }
                    ls.Save(newItem);
                }
                else
                {
                   var dicItem = ls.GetDictionaryItemByKey("TempRefreshCache");
                       foreach (var translation in dicItem.Translations)
                    {
                        translation.Value = publishId.ToString();
                    }
                  ls.Save(dicItem);
                }
    

    if that helps..

  • Jamie Attwood 207 posts 501 karma points c-trib
    Sep 28, 2015 @ 13:30
    Jamie Attwood
    0

    Thanks Marc, that is great. Thanks for taking the time to get back to me on this.

    Jamie

Please Sign in or register to post replies

Write your reply to:

Draft