I'm using /base and loving it; makes a lot of sense.
I'd like to cache some output and am wondering what the best route is - my base method is returning a large JSON string which takes some time to assemble from the database. I'd like to cache the output somehow and avoid building up the JSON each time.
Is there a more elegant method than just writing the JSON out to a file and checking for its mod date?
Using cache in /base
Hello,
I'm using /base and loving it; makes a lot of sense.
I'd like to cache some output and am wondering what the best route is - my base method is returning a large JSON string which takes some time to assemble from the database. I'd like to cache the output somehow and avoid building up the JSON each time.
Is there a more elegant method than just writing the JSON out to a file and checking for its mod date?
Hi Andrew,
You can use ASP.NET cache (Cache API), more info in here
http://msdn.microsoft.com/en-us/library/aa478965.aspx
The syntax is like the session or application (Cache scope is global)
example:
For your case i think that sould be something like
That should work- thanks!
I forgot...
In /base, you have to use HttpContext.Current.Cache["NameOfTheCache"]
;)
is working on a reply...