Ashkan S
Ashkan S

Reputation: 11501

Disable macro caching only for backoffice

I need to disable macro caching only for my back office. How can I do that?

I have some macros on my page and I've enabled macro caching for them. But I don't want the back office to be the same, and cached.

Now it is caching the macro for the page each time I want to access it no matter if I am in the back office or on the public view, it will give me the cached version.

Upvotes: 0

Views: 136

Answers (1)

Tim
Tim

Reputation: 4257

Unfortunately the caching is either on or off and must be set on the macro itself, I don't believe there's a way to vary it just for the back office.

You might be able to get round it by having the macro call a partial, and do the caching in the partial by calling another cached partial. In the first partial, you could check if you're in the back office by checking if the partial is being rendered by the macro preview like this:

if (Request.Url.ToString().Contains("GetMacroResultAsHtmlForEditor"))
{
    //do something that avoids that cache here
}
else
{
    //do something cached here
}

Upvotes: 1

Related Questions