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?
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.
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?
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.Nice... I will look at that :) thanks.
is working on a reply...