When working with umbraco, keeping in mind what is, and what
isn't cached, is crucial for performance. I keep forgetting, so I
thought I might put a list of the things you need to keep track of
here, please help me out if (and I have), I've missed anything, or
am wrong.
- The base object for Umbraco content is CMSNode, it is
constructed with an ID, and that goes to the database.
- Content is derived from CMSNode
- The Content.getProperty methods goes round-trip to the
database. All derivatives of the Content class (e.g. Document,
Media, Member),and thus behave the same way.
- Members. The Member object itself can be cached, but getting
property values is just the same as for any Content.
- Media is also a derivative of Content. (As Jeroen Breuer
mentioned in his comment, when working with Media in XSLT (via the
umbraco.library.GetMedia method), the returned XPathNodeIterator is
cached).
- Document is Content. But it can be published, and thus pushed
to the Node API, which is cached.
- Templates. Programmatic access to the templates always result
in a round trip to the database.
- ContentType.GetByAlias and GetAll goes to the database, getting
it by ID via ContentType.GetContentType is cached.
- PropertyType.GetPropertyType is cached, but all other ways of
instantiation goes to the database.
I'll edit this list as needed, I haven't worked wnough with
4.6.1 to know what's changed, so this applies to 4.5.2, at
least.
As Jeroen Breuer accurately pointed out, there's a big difference between a Node and a Document