Wednesday, February 25, 2009

The Crisis of Credit Visualized by Jonathan Jarvis


The Crisis of Credit Visualized from Jonathan Jarvis on Vimeo.

Thursday, February 5, 2009

How to use ASP.NET Caching with IconSet

I usually get questions regarding the performance of the IconSet field (http://www.codeplex.com/iconset) and I know there are some issues when there is more than one field in the view.

Using simple ASP.NET caching techniques the overall performance of the custom calculation can be improved. On the other hand the ASP.NET caching has some drawbacks for this scenario:


1. If the cache did not expire you will always see in views the cached value of the field and not the current one.
2. With this approach is no way to clear the cache for an item when the item gets updated.

How can we improve the overall effect disregarding the above drawbacks?

The page that always gets called in views is “~\web server extensions\12\TEMPLATE\LAYOUTS\csc.SharePoint\CustomFields\IconSetField\IconSetDisplay.aspx”.

This page can be modified without the need to recompile the entire application.

Let’s proceed:

The query string parameters passed to the page are:

  1. StaticName – the static name of the IconSet field
  2. ListID – the GUID of the current list
  3. ItemID – the ID (int) of the list item
  4. Value - the calculated value

First improvement technique is to use “VaryByParam” attribute of the OutputCache directive.

<%@ OutputCache Duration="15" VaryByParam=" ItemId" %>


If you have more than one IconSet field into your view you might want to regenerate the page if the “StaticName” changes, so your OutputCache directive becomes:

<%@ OutputCache Duration="15" VaryByParam=" StaticName;ItemId" %>


As general conclusion for the above modification: Use them as far as the values of the calculation are not changing within the cache time frame set in “Duration” attribute, or the outline drawbacks are somehow acceptable in your scenario. Nevertheless you can get some inspiration from Jørn Bratland's post.



If you want to find more about ASP.NET caching please refer to this article