On Tue, Mar 30, 2010 at 9:19 PM, Jurian Sluiman <[email protected]> wrote:
> At this moment I cache most models from the database, with the Core as
> frontend. So the instance of blog article with id 1 is cached with id
> blog-article-1, a blog category with blog-category-4 and an album from a
> gallery with id gallery-album-2345. But a blog article (id=1) has a
> dependency on a category, already instantiated and propbably cached as well.

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

> What is the right spot to use cache? At the most final stage, so the page
> output? At the beginning when loading the data, e.g. the database queries?

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

-- 
Giorgio Sironi
Piccolo Principe & Web Engineer
http://giorgiosironi.blogspot.com
http://twitter.com/giorgiosironi

Reply via email to