Friday, July 31, 2015

Leveraging Sitecore's Caching Mechanism

In the time I have been developing in Sitecore I have seen many different approaches to caching, but only once have I seen someone actually use caching based on Sitecore's cache service.  It is in fact almost how scary it is to implement.

Basically all you have to do is create a class that inherits from Sitecore.Caching.CustomCache.  Of course you need to implement a constructor that calls the base constructor, and override the SetObject and GetObject methods.  That is pretty much it though.

This cache will be handled in the same admin page as the other Sitecore caches, and if you install the Cache Admin or Cache Manager shared source modules you can easily use them to monitor and manage the caches without needing to build your own custom admin page.

I highly recommend at least investigating this approach to anyone considering putting in a custom cache on their site.  It is efficient enough for most scenarios as well as being very easy to setup potentially saving you hours of coding.

No comments:

Post a Comment