15 votes

Cultiv MediaCache

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.

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

<xsl:value-of select="Cultiv.MediaCache:GetMedia($currentPage/data [@alias = 'mediaItem'], 'false')/data [@alias='umbracoFile']" />

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


Archived files


Source code

Package owner

Sebastiaan Janssen

Sebastiaan Janssen

Sebastiaan has 15513 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Sebastiaan Janssen
  • Created: 20/12/2009
  • Current version 1.0.0
  • License MIT
  • Downloads on Our: 1.2K

External resources