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.

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

Screenshots

Archived files

Documentation

Source code

Project owner

Sebastiaan Janssen

Sebastiaan Janssen

Sebastiaan has 12741 karma points

Project Compatibility

This project is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Project Information

  • Project owner: Sebastiaan Janssen
  • Created: 20/12/2009
  • Current version 1.0.0
  • License MIT
  • Downloads: 1052

External resources