Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using SharePoint 2010 to build a public facing, anonymous website.

There is a web part on my home page, that displays taxonomy values from the term store. (A couple of hundred terms.)

Since this is a public facing site, the home page faces very heavy traffic.

Is it advisable to cache the taxonomy terms using some sort of caching mechanism instead of retrieving it from the term store every time the page loads? When I debug the code, I can see that the process of reading terms from the term store is an expensive operation, taking a bit more time than a regular SharePoint API call.

Do I cache the terms? Or do I not worry about it? Does SharePoint have an internal caching mechanism for the term stores by any chance, that I am needlessly worrying about a performance impact?

share|improve this question
add comment

4 Answers 4

The terms in the store are locally stored in a list: /Lists/TaxonomyHiddenList/AllItems.aspx. THis is actually done to get some performance. Whenever a lookup within another list is done, which has metadata fields in it, the actual query that is done, is a lookup query to that TaxonomyHiddenList. You could use the Content by query webpart to list all those items (don't know how you want to display the items, are they hierarchical or not etcetera.). Depending on your requirements, this might be a solution.

Aside from the caching question: what is "very heavy traffic"? Do you have numbers and how many requests per second?

share|improve this answer
add comment

The TaxonomySession constructor is overloaded with a boolean operator to update a cache internal to the Term Store. That cache is updated every 10 seconds in the background.

As both Vardhaman Deshpande and luccio stated, you'll want to look in to implementing your own logic with HttpRuntime.Cache.

share|improve this answer
add comment

Every time you use expensive operation to get data on public site, you should definitely go for caching. There is no difference between query to DB or using term store in Sharepoint.

If you feel this operation is called often (each page load) and is expensive you should cache.

There is quite a big chance that terms will not be changed very often, so you can set cache "litefime" to 24hours. If it changes more frequently set it to 1 hour.

Implementing caching with HttpContext.Cache is very easy and will take ~10minutes.

If you want learn something more about Sharepoint specific caching visit these pages: http://msdn.microsoft.com/en-us/library/ff647588.aspx

http://zimmergren.net/technical/sp-2010-developing-for-performance-part-3-caching-in-sharepoint-2010

share|improve this answer
add comment

Caching is always advisable when you are building a site with heavy traffic. In addition, you also have to think of the gradual increase in traffic over a period of time.

A while ago, I have written about the different caching options available in SharePoint 2010. See if it helps you in any way:

http://vrdmn.blogspot.in/2012/10/caching-options-in-sharepoint-2010.html

The best and most simple option for you will probably to use the HttpContext.Cache property.

Here is an example: http://www.theblackknightsings.com/CachingASharePointListAsADatatable.aspx

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.