I have a razor cshtml macro that loads data from a third-party service. Because the service is rate limited, and also to improve performance, I have this macro set to cache for 300 seconds.
Occasionally this service returns no data. When this happens, the macro renders and empty list (as designed), but the output is still cached.
Is there a way for the razor code to notify umbraco that the generated output should not be cached? Or should I build my own caching mechanism for the third party service and mark the macro as non-cached?
There's no way that I'm aware of that can let a macro indicate that it does not want to be cached, although that could be a nice addition. So I'd rather not cache the macro, and setup you own cache mechanism.
Disable razor macro from being cached via code
I have a razor cshtml macro that loads data from a third-party service. Because the service is rate limited, and also to improve performance, I have this macro set to cache for 300 seconds.
Occasionally this service returns no data. When this happens, the macro renders and empty list (as designed), but the output is still cached.
Is there a way for the razor code to notify umbraco that the generated output should not be cached? Or should I build my own caching mechanism for the third party service and mark the macro as non-cached?
There's no way that I'm aware of that can let a macro indicate that it does not want to be cached, although that could be a nice addition. So I'd rather not cache the macro, and setup you own cache mechanism.
is working on a reply...