Copied to clipboard

Flag this post as spam?

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


  • Kristoffer 10 posts 80 karma points c-trib
    May 16, 2019 @ 11:30
    Kristoffer
    0

    Saving media with MediaService does not update caches

    Hi! I'm experiencing some problems with media-cache not being updated after i programatically save (MediaService) a media-item. Any pointers on how to invalidate/refresh the media-cache?

    The item (More specifically, a folder) has its "new" name in the backend, but in the front-end, it does not.

    The second I click "Save" in the backend on the item I am trying to update, the front-end displays the right name.

    I've tried the following things: Rebuilding both the Internal/External Examine Indexes, Rebuilding the "XML structure" (ApplicationContext.Current.Services.MediaService.RebuildXmlStructures()).

    I'm guessing there is some sort of cache that I invalidate when clicking "Save and Publish" on the media-page in the backoffice, that apparently does NOT get updated/invalidated when I programatically update media.

  • Lasse Kofoed 49 posts 177 karma points
    Jan 18, 2020 @ 21:45
    Lasse Kofoed
    0

    Did you find a solution to this ?

    I am having the same problem : Backend sees the change, frontend ( TypedMedia ) dont

    Umbraco version 7.14.0

    var _mediaService = ApplicationContext.Current.Services.MediaService;
    IMedia media = _mediaService.GetById(model.Id);
    
    var newOwner = _memberService.GetById(model.Owner);
    media.SetValue("owner", newOwner.GetUdi().ToString());
    _mediaService.Save(media);       
    

    If i wait ~2 min I can see the new value in frontend ?

  • Lasse Kofoed 49 posts 177 karma points
    Jan 19, 2020 @ 08:42
    Lasse Kofoed
    0

    The InternalIndexer had deletions and where not optimized.

    After i Rebuild index on InternalIndexer in the Developer/Examine Management menu, the changes appear instant.

Please Sign in or register to post replies

Write your reply to:

Draft