Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

thought that if I set up caching, it is supposed to stay resident in the web server unless I restart it.

 

IN my following code-behind, the very first time in the page for every user, it always populates the cache. I am expecting the cache to be populated only once until I remove it.

 

DsCrewChief1 = CType(Cache("CrewChief"), dsCrewChief)

If DsCrewChief1 Is Nothing Then 'it goes into this if statement the first time thru the page

Dim clsNCVACBLL As New NCVACBLL.Scheduling(CType(Application("strDataSource"), String))

DsCrewChief1 = New dsCrewChief

DsCrewChief1 = clsNCVACBLL.SelectCrewChief()

Cache.Insert("CrewChief", DsCrewChief1, Nothing)

clsNCVACBLL.Dispose()

End If

 

This is at the top of my HTML:

<%@ Reference Page="..\Default.aspx" %>

<%@ Register TagPrefix="mbrsc" Namespace="MetaBuilders.WebControls" Assembly="MetaBuilders.WebControls.RowSelectorColumn" %>

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="SignUp.aspx.vb" Inherits="NCVAC.SignUp"%>

 

On subsequent postbacks, it does read the data from cache. But, if I end my browser session and start the project again, it re-populates the cache which, again, I'm not expecting it to do. I'm expecting it to read it from cache since the dataset should be populated. I am NOT setting this dataset to NOTHING anywhere in the code...

 

What concept am I missing here? Am I supposed to set something up on the webserver (IIS5.1)?

Thanks,

 

Bill Yeager (MCP, BCIP)

Microsoft Certified Professional

Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer

YeagerTech Consulting, Inc.

Posted
no difference......

Thanks,

 

Bill Yeager (MCP, BCIP)

Microsoft Certified Professional

Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer

YeagerTech Consulting, Inc.

  • *Gurus*
Posted
You cannot guarantee that an item placed in the cache will remain in the cache, even for the time specified by the developer. If the cache service starts allocating too much memory or your ASP.NET application is restarted, which happens more often than one would think, the cache will purge some or all of the items it contains. There is little you can do to prevent this.
  • Administrators
Posted (edited)

Are you testing this from the debug environment? If so when the one and only session ends then the web application is terminated and the cache is cleared. If multiple users are accessing the web application then the cache should last (see Derek Stone's comment about memory usage above)

 

edit : typo

Edited by PlausiblyDamp

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
Thanks for the insight.. As long as I know it's functioning the way it's supposed to.

Thanks,

 

Bill Yeager (MCP, BCIP)

Microsoft Certified Professional

Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer

YeagerTech Consulting, Inc.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...