Cache Manager

March 22, 2011
Tags: JQuery, Sitecore

So if you've ever setup caching on a Sitecore site you'd be familiar with the admin cache page. I recently had to set it up on a fairly large existing site and though there were a lot of other issues, one was that I was overwhelmed by the length of the list I had to view to get the information I needed. So I spent a little time and built a new admin cache page so that I could search just for what I wanted and clear out the excess noise. I built it to be a drop in place setup so that there are no external libraries or files. You can literally just copy these files into the same folder the original is in and you should be able to start working with it. You can get the files on the Cache Manager UI or checkout the source on Github.

Some things to note before I dive into what this does: You should see "Toggle" buttons at the top of each form region. This allows you to expand/collapse sections of the page below it. The more sites and results you'll get the more important this will become. There are also four distinct details forms. Sitecore stores cache objects by name and you'll see, on the original admin cache page that there are some names that appear several times (like sites) with slight variations (html, xsl, viewstate, etc.). The detail forms separate these values so that you have the ability to get just the html cache or just the xsl cache. The DB caches have a different subset of types and Miscellaneous are all unique by name. There is also one that doesn't really fit which is the AccessResultCache. This is storing security information and the cache keys are stored as a private class type so there's no way to know what they are. Ok let's get to some of the changes that I made and what you can do with it.

So first when you hit the page you'll see the default information such as total entries, total size and clear all button as you'd expect. Below that the first thing you'll see is a text search form.

Page Load

If you run a search for "sitecore" you'll get a few hits. This will check all caches for the text (I blanked out the names of the sites I'm working on). This doesn't support regex or anything special. At it's core compares using a contains method so you can do partial id's or paths and get results. If you enter nothing you should get all cache entries.

Search

The details form has three parts: the form, the summary and the cache entries. The form is your filter. You can say you just want to get the html cache for a single site or all sites.

 Toggle Form

Once you've decided on what to filter when you click the "Get Summary" button you will see the number of entries and size for each cache object. Basically what the original admin cache page would tell you. 

Get Summary

You can collapse the summary and click now on "Get Cache Entries". This will enumerate the individual cache keys in each of the cache objects. Be aware that if you try to get all the cache keys for all caches or a very large cache you could well be waiting a while for the results.   

Get Cache Entries

You'll also see that there are clear cache buttons. Each section has it's own and will basically run the same search with the exception that it will clear the cache on any results. On a text search you can clear individual cache keys, but on the detail forms you'll be clearing all cache keys on any resulting cache objects.

Alright that's it. Hopefully you'll get as much mileage out of this as I did.