The data for my web app is an object model that consists of a class with a
series of properties typed as generic.list(of SomeClass). The object model
gets built up along the way by calls to SQL Server. Some of the data is
global data, some of it is user data. Instead of making multiple calls to
the DB to get the same data, I was thinking that I could cache the object
model and retrieve it.

To do that in .net 1.1, I would have done something like this

Dim _GobalData as new GlobalDataObjectModel
_GobalData = Cache("GlobalData")
If _GlobalData Is Nothing Then
_GlobalData = CreateGlobalData
Cache("GlobalData") = _GlobalData
End IF
UseGlobalData()

It seems caching in .net 2.0 is quite different. For one thing, there seems
to be a problem with my reference to *cache*. Is it possible to do this? If
so, what is the namespace for *cache*? Do I need to do this some other way?

RE: Caching App Data by pbromberg

pbromberg
Wed Mar 12 15:11:29 CDT 2008

The namespace is System.Web.Cache. If you are having trouble, try
HttpContext.Current.Cache.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


"Dave T" wrote:

> The data for my web app is an object model that consists of a class with a
> series of properties typed as generic.list(of SomeClass). The object model
> gets built up along the way by calls to SQL Server. Some of the data is
> global data, some of it is user data. Instead of making multiple calls to
> the DB to get the same data, I was thinking that I could cache the object
> model and retrieve it.
>
> To do that in .net 1.1, I would have done something like this
>
> Dim _GobalData as new GlobalDataObjectModel
> _GobalData = Cache("GlobalData")
> If _GlobalData Is Nothing Then
> _GlobalData = CreateGlobalData
> Cache("GlobalData") = _GlobalData
> End IF
> UseGlobalData()
>
> It seems caching in .net 2.0 is quite different. For one thing, there seems
> to be a problem with my reference to *cache*. Is it possible to do this? If
> so, what is the namespace for *cache*? Do I need to do this some other way?