This package is ONLY needed for Umbraco versions lower than 4.5! In 4.5 caching of media items is already built in.
Calls to the Umbraco media library are not being cached, they go directly to the database. For each call to the "GetMedia" method, 3 queries are executed in the database.
This package provides an XSLT extension that provides a caching mechanism for calls to the "GetMedia" method.
The cache for a specific item is flushed when you save a media item in the media section. The cached item is also removed when you delete it.
The media items are being cached in the Application items (HttpContext.Current.Application). This means that you can completely clear the cache by touching the web.config or recycling the application pool.
Usage:
MediaCache can be used EXACTLY the same as umbraco.library:GetMedia (http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia). The only thing you need to do is replace "umbraco.library" with "Cultiv.MediaCache".
Example:
<xsl:value-of select="Cultiv.MediaCache:GetMedia($currentPage/data [@alias = 'mediaItem'], 'false')/data [@alias='umbracoFile']" />
Note:
If you're going to use this with existing XSLT files, you will need to add this in the xsl:stylesheet element: xmlns:Cultiv.MediaCache="urn:Cultiv.MediaCache" and in the exclude-result-prefixes: Cultiv.MediaCache