Copied to clipboard

Flag this post as spam?

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


  • Richard Thompson 100 posts 336 karma points
    Jan 13, 2016 @ 15:47
    Richard Thompson
    0

    Regenerating cache through the API

    I'm using the API to set some values for node pickers against some nodes. This works great and in the back office I can see the values have been assigned.

    My problem is that these values won't show up in my templates as they are missing from the XML cache file.

    I set the property value through the API and then call SaveAndPublishWithStatus on the node. Once I've finished with all nodes I've tried deleting the cache file and the following lines to force the XML cache file to be generated:

    contentService.RePublishAll();
    contentService.RebuildXmlStructures(new int[] { TYPE_1, TYPE_2 });
    

    I've also tried the following line which falls over with an error:

    umbraco.library.RefreshContent();
    

    It's an Umbraco 7.3.4 site. Can somebody please explain how I would programatically rebuild the cache through the API.

  • Richard Thompson 100 posts 336 karma points
    Jan 22, 2016 @ 14:01
    Richard Thompson
    0

    It turns out you can't clear the cache from the console. What you need to do is use the WebApi and you can rebuild the cache from there.

    https://our.umbraco.org/forum/developers/api-questions/39164-Console-Application-Publishing-Problem#comment-189720

Please Sign in or register to post replies

Write your reply to:

Draft