Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / April 2006

Tip: Looking for answers? Try searching our database.

HELP! With HttpRuntime.Cache

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bishop@OnTheBoard.com - 12 Apr 2006 01:45 GMT
I have googled to try and find an answer to this issue, but everything I
found
beats around the bush.

I have a web service that calls a DLL. In the DLL, I want to cache the small
table
data into server cache rather than hit the DB each time, since the data does
not
change for at least a day.

My question is, will this cache still be there when the web service is
invoked
again? Or does the cache only last as long as the web service (and DLL) is
instantiated?

Here is a snippet of the code:

try {
  ds = (DataSet)HttpRuntime.Cache.Get("AVMPolicies");   
} catch (Exception ex) {
  strErrMsg += ex.Message;
  throw new Exception(strErrMsg);
}
...
if (ds == null) {
  //cache gone, get from DB
  try {
     //ORACLE
     ds = OraRules.GetPoliciesDB();
     //OTHER
     //...
  } catch (Exception ex) {           
     //bubbled
     throw new Exception(ex.Message);
}
...
//store in cache
try {
  HttpRuntime.Cache.Add("AVMPolicies",ds,null,DateTime.Now.AddMinutes(intTimeout),TimeSpan.Zero,CacheItemPriority.High,null);
} catch (Exception ex) {
  strErrMsg += ex.Message;
  throw new Exception(strErrMsg);
}
...
======================================================================
intTimeout is 15.

Thanks,
Bob
Cor Ligthert [MVP] - 12 Apr 2006 08:01 GMT
Bishop,

I hope that it is that the cache will only be there as long as the
Webservice is active. Otherwise by instance with testing we would get as
much caches as there are tests done.

However, this is of course another situation if you use your DLL in a
windowservice which you use in the webservice.

Just my thought,

Cor

>I have googled to try and find an answer to this issue, but everything I
> found
[quoted text clipped - 48 lines]
> Thanks,
> Bob

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.