Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 10, 2015 @ 11:45
    Ismail Mayat
    0

    Update dictionary cache on distributed server

    We have a bunch of sites most are umbraco v6 and one is v4.9. Each site has a cms url site and the other is the live front end site. Both share same database. Content editing is done on cms site only, front end site does not even have umbraco access.

    When you publish nodes etc on cms site distributed publish calls are made to front end site so all content is up to date. One issue is when we update dicitonary items on cms site they are not reflected on the front end site. To get them to appear we have recycle app pool. Is there a way to update / clear dictionary cache on front end server?

    Regards

    Ismail

  • Comment author was deleted

    Jul 10, 2015 @ 12:01

    Good question as I'm curious myself. I was hoping to find a 'OnDistributedCall` event or something like that but found a 404 page instead.

    https://our.umbraco.org/Documentation/Reference/Events/index/Document-Events

    My hope was you could tie into that event.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 10, 2015 @ 13:50
    Ismail Mayat
    0

    Kevin,

    Don't suppose you know where in the source and how it does the add of dictionary items to cache and removes them? I got a bit of a dirty hack but need to see how its added and removed from cache?

    Regards

    Ismail

  • Comment author was deleted

    Jul 10, 2015 @ 13:56

    I do not sorry.

  • Comment author was deleted

    Jul 10, 2015 @ 15:11

    If you are still on v4 check out the method umbraco.presentation.cache.dispatcher.Refresh(factoryGuid, id);

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 10, 2015 @ 15:56
    Ismail Mayat
    0

    Tim,

    Cheers will take a look at this.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 13, 2015 @ 11:43
    Ismail Mayat
    0

    Tim,

    I have had a bit of a sniff around the code base and the dictionary items are cached in memory in hashtable

    private static Hashtable DictionaryItems = Hashtable.Synchronized(new Hashtable());
    

    And hash table is updated when you add / remove / update dictionary items.

    So I do not think what I want to do is doable.

    Regards

    Ismail

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jul 30, 2015 @ 16:11
    Marc Goodson
    0

    Hey Ismail,

    I think there is stuff coming in 7.3 so that you can call:

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

    but in older Umbraco versions, I've tapped into the

    • LocalizationService.SavedDictionaryItem
    • LocalizationService.DeletedDictionaryItem

    events - and older still

    • Dictionary.DictionaryItem.Saving - (fires for each translation)
    • Dictionary.DictionaryItem.Deleting

    to trigger either ICacheRefresher or DB entry (see Moriyama.Cloud on github) and then when that executes on the 'other' servers, I then - (warning horrible hack) - Create a dictionary item called 'TempCacheRefresh' if it doesn't exist, and then update it if it does - the act of updating or creating this 'dummy' dictionary item on the 'other' server clears all of the Dictionary Item Cache for any updated items.

    regards

    Marc

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 31, 2015 @ 10:57
    Ismail Mayat
    0

    Marc,

    You got link for the moriyama.cloud on github i cannot find it.

    Regards

    Ismail

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Aug 02, 2015 @ 22:38
    Marc Goodson
    0

    Hey Ismail,

    I've added the dictionary stuff to a fork here:

    https://github.com/marcemarc/cloud-umbraco-cache-refresh

    but if your using the more typical distributed calls Webservices in a load balanced environment, you could create an ICacheRefresher:

    https://our.umbraco.org/Documentation/Reference/Cache/cache-refresher

    and do the sneaky dictionary item create/update in your custom Refresh method.

    Triggering the ICacheRefresher when dictionary items change (above events fire).

Please Sign in or register to post replies

Write your reply to:

Draft