5

Is it supported to add the same rendering to two (or more) different cache settings items?

Currently, there is no warning if you do so, but I'm unsure if this is a valid thing to do or not?

enter image description here

6

You can answer this question on your own by using DotPeek. The GetSiteLevelCaching processor in GetRenderingCaching pipeline is responsible for processing those items. The code looks like this:

public void Process(GetRenderingCachingArgs args)
{
    ...

    var renderingId = args.Rendering.RenderingItem?.ID.ToString() ?? args.Rendering.RenderingItemPath;
    foreach (Item cacheSetting in cachingFolder.Children)
    {
        ...

        if (!cacheSetting[Templates.CacheSettings.Fields.Renderings].Contains(renderingId))
        {
            continue;
        }

        PopulateCacheOptions(args.Rendering, cacheSetting);
        args.Rendering[Constants.InheritedCaching] = "1";

        break;
    }
}

As you can see, there is a break statement in the main loop. That means that when there is a CacheSetting item which will contain current rendering, we will read caching settings and break the loop. In other words - only the first CacheSetting item containing particular rendering will be processed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.