Copied to clipboard

Flag this post as spam?

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


  • trfletch 598 posts 604 karma points
    Jun 03, 2016 @ 17:18
    trfletch
    0

    Rebuild media cache, TypedMedia not return all files

    I have been importing media items into Umbraco using C# and to improve the performance of the import I temporarily changed the following in the "umbracoSettings.config": <ContinouslyUpdateXmlDiskCache>False</ContinouslyUpdateXmlDiskCache>

    I have since changed it back to "true" but I cannot seem to return any of the new files I imported using the API, this includes new files I manually add. If I run the following code it will only return the files that were added to the media section before the import:

    var test1 = UmbracoHelper.TypedMediaAtRoot().DescendantsOrSelf("File").ToList();
    

    I have tried running this:

    DistributedCache.Instance.RefreshAll(new Guid(DistributedCache.MediaCacheRefresherId));
    

    And going here and rebuilding the cache:

    /Umbraco/dialogs/republish.aspx?xml=true
    

    But nothing seems to work. Please can someone help :-(

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jun 03, 2016 @ 19:48
    Nicholas Westby
    101

    Media is not stored in the XML cache. It's stored in the Examine index. Go to the developer section and rebuild your internal and external indexes:

    Examine

    Though, the Umbraco core is supposed to revert to a database query if it can't find the media in the Examine index, so not sure what the issue might be exactly.

  • trfletch 598 posts 604 karma points
    Jun 03, 2016 @ 22:18
    trfletch
    0

    Thank you, you are a life saver! I didn't mention that I also disabled Examine during the import to speed things up but I didn't think this was relevant because I thought TypedMedia would be using the XML cache the same as TypedContent. I rebuilt the Internal Index and it is now finding all the new media items.

Please Sign in or register to post replies

Write your reply to:

Draft