On Wednesday 31 Mar 2010 09:28:59 Giorgio Sironi wrote: > This is not a simple problem. If you have a graph with few > associations, you may want to cache the serialization of isolated > parts of the graph (article and its category... but if the category > has references to a collection of its articles the whole process > explodes.)
It becomes indeed a large graph (category > blog article > comment > user > blog article etc). All my objects are Doctrine records, so I thought of the following: An abstract class used by all my Doctrine objects, having a magic __sleep() and __wakeup(). The wakeup set the state of the instance to Doctrine_Record::STATE_PROXY (meaning "not all properties are loaded yet"). The __sleep() will use reflection to return the parameters of the instance not being a relation. Of course you're able to add/remove items to the sleep array in the instance itself. > These are all valid points, but you should profile your application > with XDebug to find out where the bottleneck is before starting to > caching things in places where it may not be need. For finding where > most of the loading time is spent, ut's actually very simple and I > have a post on my blog explaining it (but I do not want to spam, thus > I'll post the link only if someone asks.)-- My problem is *many* data is loaded. Besides acl, auth and i18n also containers at the page with "latest blog posts", "last tweet", "recent pictures" etc. Therefore I thought let's cache everything! :p But you're right I need to profile first to know exactly the place I need to have caching enabled. I let you know what the outcome is of my cache idea. BTW I couldn't find the blog article you were talking about. Please post it (so others might have benefit of it as well). Jurian Sluiman CTO Soflomo V.O.F. http://soflomo.com
