Released: Media cache package

Note: this post is over a year old, it's very likely completely outdated and should probably not be used as reference any more. You have been warned. :-)

Recently, I've been working on a site that presents 30 to a 120 items from Umbraco's media section in the frontend of the website.

In the past few weeks, I've been tweaking the site for performance and noticed that there were an aweful lot of SQL queries being performed in the database. As it turns out, calls to the umbraco.library:GetMedia() method are being sent directly to the database. This meant that for each media item, three queries are being performed. Times a 120... That starts to hurt a little.

Also, it is impossible for us to turn on caching on this macro completely because updating the media item with a new image would not expire the cache.

I had to come up with something else that would cache calls to the media library. So today, I'm presenting you the Cultiv MediaCache package.
This package provides an XSLT extension that provides a caching mechanism for calls to the "GetMedia" method.

It's very easy to use:
In your XSLT files, instead of doing calls to umbraco.library:GetMedia(), you do them to Cultiv.MediaCache:GetMedia().
That's it! Told you it was easy.

Read all about it on the project page, download it, use it, vote it up. Okay, thanks! :-)

Tiny update dec 20, 2009 - 17:28: Now compatible with .net 2.0 installs of Umbraco (previously only worked on .net 3.5).

Sebastiaan Janssen

Dutch guy living in (and loving) Copenhagen, working at Umbraco HQ. Lifehacker, skeptic, music lover, cyclist, developer.

 

3 comments on this article

Avatar for Sebastiaan Janssen Sebastiaan Janssen | June 24 2013 17:30
test

Avatar for Sebastiaan Janssen Sebastiaan Janssen | June 24 2013 17:31
test

Avatar for Sebastiaan Janssen Sebastiaan Janssen | June 24 2013 17:33
test