Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

Cache template areas OR Best method for complex menus


Reply

5 Posts   1201 Views

Avatar
Marcus

26 October 2009 at 12:48pm Administrator, 86 Posts

Assume for a moment that I have a menu with ~1000 items in it (I know, from an IA point of view it's not ideal, but some clients do 'require' it). I haven't actually tested this yet, so I'm only thinking through based on what I've seen happen on other systems... but generally, this takes a lot of time to put together.

Is there a way to specify in a .ss template that the output of a certain region should be cached as rendered for a period of time?

Avatar
sdbruder

2 December 2009 at 10:43am Community Member, 4 Posts

Ive just published an initial patch (against trunk) of caching suport for arbitrary methods of any Object-children, it's in silverstripe-dev (http://groups.google.com/group/silverstripe-dev/browse_thread/thread/d327a13ff58c45cb).

Avatar
Willr

2 December 2009 at 12:11pm Forum Moderator, 5511 Posts

There is also a partial caching system that is due to be merged into 2.4 soon which will allow you to cache sections of templates.

Avatar
markguinn

20 December 2009 at 2:28am Community Member, 13 Posts

I'd love to hear more (or be pointed to a source to read more) about the partial caching in 2.4. We've faced similar problems and thus far solved them by using limited caching of objects (DataObjectSet, etc.) using Zend_Cache. It's worked ok, but I agree that it be helpful to have more options, such as caching part of a template, and would be happy to help that come to fruition. I see that Zend_Cache is now included in the 2.4 branch too so that's good news.

Avatar
Willr

20 December 2009 at 10:25am Forum Moderator, 5511 Posts

markguinn - currently its not documented due to the fact it hasn't even made the core yet and the API could change in the mean time. Once its been released then you'll hear all about it :)