PDA

View Full Version : Taking advantage of the ASP.NET Cache


tbroyer
02-19-2007, 02:06 PM
Hi Bruno,

Your last version (20070218-1949) never takes advantage of the ASP.NET Cache:

object webServiceData = context.Cache.Get(filename);

context.Cache.Insert("System.Web.Script.Services.WebServiceData:" + filename, webServiceData);
I'm already using this code in a project at work and, to accomodate the 1.0 "final" release of ASP.NET AJAX, I modified it as follow:

static private readonly MethodInfo webServiceData_GetCacheKey =
webServiceDataType.GetMethod("GetCacheKey", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(string) }, null);

string cacheKey = (string) webServiceData_GetCacheKey.Invoke(null, new object[] {
VirtualPathUtility.ToAbsolute(context.Request.File Path)
});
object webServiceData = context.Cache.Get(cacheKey);

context.Cache.Insert(cacheKey, webServiceData);
You'll hopefull find where those lines go ;)

Bruno Baia
02-19-2007, 10:54 PM
Hi,

Thanks for catching this.
I didn't think when I made the quick fix to make it work with the RTM.


Bruno

Bruno Baia
02-19-2007, 11:44 PM
I commited the changes.

I also fixed the issue I mentioned here :
http://forum.springframework.net/showthread.php?t=1682


Bruno