/
Cache usage approach

Cache usage approach

Imported From: http://groups.google.com/group/in-portal-dev/browse_thread/thread/818b4b3d9c4be91a#

We currently have 2 caching modes:

  • cache page completely (only makes sense for static page - when all visitors see the same content)
  • cache template parts via <inp2:m_Cache ...> cacheable content here </inp2:m_Cache> tag

I've recently talked to Slava and he suggested another caching approach:

  • cache all but specific page parts, e.g. located in <inp2:m_NotCache ...>...</inp2:m_NotCache> tags

This will work this way:

  • cold start (when page not cached):
    • parse all <inp2: tags in requested template, but don't parse tags in <inp2:m_NotCache ...> tags
    • store resulted HTML (with some non-parsed tags in it) in memory
    • read cached page from memory
    • parse tags, skipped during page caching process
    • show page
  • normal start (when we have cache):
    • read cached page from memory
    • parse tags, skipped during page caching process
    • show page

When page mostly consists of static parts, then selecting non-static parts will be more efficient (less tags required), then marking all cacheable parts. Also it's easier to read one large part from cache, rather than a lot of small parts.

For example cache all page, but mark areas, where banners are displayed as non-cacheable.

Of course <inp2:m_NotCache tag will only make sense, when page is selected to be fully cache (in "Structure & Data" in admin console).