Open jkoudys opened 10 years ago
After talking more with the good people in #hhvm, I've rethought this. It's still a good idea, but it needs to be implemented from the other side: don't build the tree then go back and add caching attributes, but check the config for every
Here's an idea now that c5 elements can be used with Cache:
A future-feature could be something like WebSphere dynacache's cachespec.xml, but more readable and without the bloat. The xhp tree can be traversed with selectors, so you could apply caching rules based on those. This would, of course, require that you build your whole view into an XHP tree, and not have any errant 'echo' statements, but have the whole tree built under one xhp. Having a standard place for this is a definite 'nice-to-have' reason to put something like this in the c5 core.
I can't find any way to search down more than one level (e.g. the :xhp.getChildren($selector) only selects the immediate children), so there might be a bit of work to do to traverse the whole tree. I'd much rather see a feature on this come from the hack-people, since anything I'd write as an extension couldn't run half as fast, and it's self-defeating if tree-traversal is slow. You might be slowing down rendering time for a feature meant to speed up rendering time.