/* no cache found, build the collection... */ /* at the end save it to cache */ $cache->save($collection);
}
Now you’ll see your cached collection data is under /var/cache/local folder
If you don’t specify an expire time as parameter when calling new Collection_Cache() your data will never expire, letting you the chance to do it everytime you need
Choose tags appropriate to the content of the collection so that it will be flushed automatically. This way builds an ID based on the query being executed, it is most useful when the collection is filtered, ordered or paged - it avoids a version conflict.
Generally this hardly gets used because when you retrieve data you almost always end up displaying it, probably as HTML, so it makes sense to cache the output instead. Block caching is widely used and better documented.