Copied to clipboard

Flag this post as spam?

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


  • Niels Henriksen 74 posts 277 karma points
    Jul 05, 2019 @ 13:40
    Niels Henriksen
    0

    Cache custom data

    I am making a webshop for a customer and there is a huge amount of data he need to choose from (categories for products etc). But instead of loading the data in the controller every time he need to edit or add a product I want to preload the data.

    Can I preload a controller when the package.manifest is loaded and then use the data from that?

  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    Jul 08, 2019 @ 13:39
    Søren Kottal
    0

    Hi Niels

    You can load your data into the Runtime cache (docs for v7 here: https://our.umbraco.com/Documentation/Reference/Cache/updating-cache, v8 is pretty much the same, you can find the caches through Current.AppCaches - or use DI, and I think the get method is just named Get)

    I would probably have some kind of scheduled task (either by using Hangfire, or have an API controller do it with an entry in <scheduledTasks> in umbracoSettings.config) doing the caching part, so your controller just gets the content from the cache.

  • Niels Henriksen 74 posts 277 karma points
    Jul 08, 2019 @ 13:40
    Niels Henriksen
    0

    Nice... I will look at that :) thanks.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

    Continue discussion

Please Sign in or register to post replies