29 October 2007

A Nice Trick for Caching by User

I wrote a quick overview of caching (and state) the other day and saw a great VaryByCustom tip on Steven Smith's blog today.

VaryByCustom allows you to use a global.asax method (GetVaryByCustomString) to return a string that will act as your VaryBy key.  In Steven's tip, they return the current user's username, essentially create a user specific cache.  This allows you to use all of the cache invalidation and other tools that the Cache class offers.

Sweet!

Filed under:

Comments

No Comments

 

News

Hey, somebody remind me to put something good in this space. :)