If you have access to the source code of the web app, you can also create inherit from Page and add the following two methods. I prefer the HttpModule myself, but this is pretty convenient. You'll still need to set up the memcached settings in web.config
protected override void SavePageStateToPersistenceMedium(object state)
{
var key = Guid.NewGuid().ToString();
BeIT.MemCached.MemcachedClient.GetInstance("ViewStateCache").Add(key, state);
base.SavePageStateToPersistenceMedium(new Pair("Key", key));
}
protected override object LoadPageStateFromPersistenceMedium()
{
var pair = (Pair)base.LoadPageStateFromPersistenceMedium();
return BeIT.MemCached.MemcachedClient.GetInstance("ViewStateCache").Add(key, pair.Second);
}
Tuesday, 6 May 2008
Storing ViewState in memcached part 2
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment