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


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))

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


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.

| improve this answer | |

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.