PC Review


Reply
Thread Tools Rate Thread

Caching App Data

 
 
Dave T
Guest
Posts: n/a
 
      12th Mar 2008
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?
 
Reply With Quote
 
 
 
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      12th Mar 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?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Caching data 3P Microsoft ASP .NET 6 24th Sep 2009 07:44 PM
ANN: New Article: Improving Data Access Performance with Data Caching Microsoft Dot NET Compact Framework 0 21st Sep 2007 05:14 PM
data caching m.posseth Microsoft VB .NET 2 22nd May 2005 01:14 PM
Caching data in a web app Mark Microsoft ASP .NET 3 30th Aug 2004 04:06 PM
Best for caching data Janaka Microsoft ASP .NET 0 3rd Feb 2004 05:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 PM.