U4-4624 - Media cache hits the DB on every empty property

Created by Stephan 05 Apr 2014, 09:02:48 Updated by Asbjørn Riis-Knudsen 20 Jun 2014, 22:37:49

Relates to: U4-4798

Relates to: U4-5118

Create a additional textstring property on the Image media type. Create an Image media but leave that field empty. Examine does not create an entry for that field / the DictionaryPublishedContent contains no trace of the property. Try a GetProperty(...) on that property => in PublishedMediaCache.GetProperty(DictionaryPublishedContent, string) we determine that the property is a valid property but missing from the DictionaryPublishedContent, and so we reload the media from the DB. Bad performance hit.

This was because we assumed that if the property is not in Examine then the indexing went wrong. But this is bad for perfs. No idea what we should do yet, but we should do something.


Shannon Deminick 01 May 2014, 00:04:07

I will try to replicate this, i believe it is related to this change: http://issues.umbraco.org/issue/U4-3091

What we need to do is assume that the media item is indexed in the Examine index if the node exists there by the Id specified. Examine should always be in sync and there's been more fixes in this release to ensure that is the case.

Shannon Deminick 01 May 2014, 00:13:57

Also, it doesn't always go to the db, it goes to: global::umbraco.library.GetMedia(dd.Id, true);

which caches the media result. In any case, i think we should remove this index check and assume that if the id is in the index that it is correct.

Shannon Deminick 01 May 2014, 01:36:47

I've fixed this in rev:


We no longer go back to the library media cache if the property is not found - in fact that would cause problems anyways because we no longer output empty xml elements in the xml cache so that might have caused a stack overflow if we did go back to the library media cache and it was not found there either.

This rev also fixes this issue: U4-4338

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 6.2.0

Due in version: 6.2.0


Story Points: