wsyeager Posted August 30, 2003 Posted August 30, 2003 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)? Quote Thanks, Bill Yeager (MCP, BCIP) Microsoft Certified Professional Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer YeagerTech Consulting, Inc.
Administrators PlausiblyDamp Posted August 30, 2003 Administrators Posted August 30, 2003 Not sure what the defaults are if you use Cache.Insert, try Cache.Add - this allows you to specify things like expiry times for cached items. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
wsyeager Posted August 30, 2003 Author Posted August 30, 2003 no difference...... Quote Thanks, Bill Yeager (MCP, BCIP) Microsoft Certified Professional Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer YeagerTech Consulting, Inc.
*Gurus* Derek Stone Posted August 30, 2003 *Gurus* Posted August 30, 2003 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. Quote Posting Guidelines
Administrators PlausiblyDamp Posted August 30, 2003 Administrators Posted August 30, 2003 (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 August 30, 2003 by PlausiblyDamp Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
wsyeager Posted August 30, 2003 Author Posted August 30, 2003 Thanks for the insight.. As long as I know it's functioning the way it's supposed to. Quote Thanks, Bill Yeager (MCP, BCIP) Microsoft Certified Professional Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer YeagerTech Consulting, Inc.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.