473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

cache reseting problem stumped

I have an asp.net project with a business layer (project) that has a class
called references. It loads up a data set and stores in cache with the
following code.

_cached = CType(HttpContext.Current.Cache("cached"), String)
If HttpContext.Current.Cache("cached") Is Nothing Or _cached <>
"loaded" Then
MyBase.CreateCommand("SA_GetReferences", _connectionString)
_dsReferences = MyBase.ExecDataSet
HttpContext.Current.Cache.Insert("dsReferences", _dsReferences,
Nothing, DateTime.Now.AddMinutes(60), TimeSpan.Zero)
HttpContext.Current.Cache.Insert("cached", "loaded", Nothing,
DateTime.Now.AddMinutes(60), TimeSpan.Zero)
End If
_dsReferences = CType(HttpContext.Current.Cache("dsReferences"),
DataSet)

I have a number of properties that checks if in cache and if so returns the
appropriate datatable. If not then it loads up via above method..

Public ReadOnly Property dtLegalEntities() As DataTable
Get
LoadDs()
Return _dsReferences.Tables(9)
End Get
End Property
I also have a shared method to set cache to 'clear' in the few cases when i
want to clear it out.

Public Shared Sub ClearCache()
HttpContext.Current.Cache("cached") = "clear"
End Sub

The problem is that for some reason the app error's out complaining that
datatables are not in cache. I dont know how that is possible as with each
reference to the datatable it does the above check. I have made sure that
none of the cached tables are set to nothing.

any ideas on why this is happening? (i have used this technique in other
apps and have not seen this as a problem before).

thx
dave

Apr 13 '07 #1
1 1385
KJ
I suggest you use the overloaded version of Cache.Insert, and specify
a CacheItemPriority of AboveNormal. Otherwise, it will be dumped from
the Cache asap. To see if this is what's happening, provide a
CacheItemRemovedCallback delegate parameter as well to Insert.

On Apr 13, 4:02 pm, dave <d...@discussions.microsoft.comwrote:
I have an asp.net project with a business layer (project) that has a class
called references. It loads up a data set and stores in cache with the
following code.

_cached = CType(HttpContext.Current.Cache("cached"), String)
If HttpContext.Current.Cache("cached") Is Nothing Or _cached <>
"loaded" Then
MyBase.CreateCommand("SA_GetReferences", _connectionString)
_dsReferences = MyBase.ExecDataSet
HttpContext.Current.Cache.Insert("dsReferences", _dsReferences,
Nothing, DateTime.Now.AddMinutes(60), TimeSpan.Zero)
HttpContext.Current.Cache.Insert("cached", "loaded", Nothing,
DateTime.Now.AddMinutes(60), TimeSpan.Zero)
End If
_dsReferences = CType(HttpContext.Current.Cache("dsReferences"),
DataSet)

I have a number of properties that checks if in cache and if so returns the
appropriate datatable. If not then it loads up via above method..

Public ReadOnly Property dtLegalEntities() As DataTable
Get
LoadDs()
Return _dsReferences.Tables(9)
End Get
End Property

I also have a shared method to set cache to 'clear' in the few cases when i
want to clear it out.

Public Shared Sub ClearCache()
HttpContext.Current.Cache("cached") = "clear"
End Sub

The problem is that for some reason the app error's out complaining that
datatables are not in cache. I dont know how that is possible as with each
reference to the datatable it does the above check. I have made sure that
none of the cached tables are set to nothing.

any ideas on why this is happening? (i have used this technique in other
apps and have not seen this as a problem before).

thx
dave

Apr 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: waschbaer2 | last post by:
Hi! What's the proper Visual Basic for Applications (VBA) code for reseting the menu bar and the tool bar in Access. Thanks in advance, Markus
3
by: martin | last post by:
Hi, I am storing a dataset in cache, which is happening fine. I can easily retrive it at postback from the cache, cast it to a dataset and reuse it. However I have specified that the cache...
1
by: martin | last post by:
Hi, I have a page that contain a dropdown list of values. This drop down list rarely changes so I wish to cache the page. However the values in the dropdown box are taken from a database, so if...
1
by: Dave | last post by:
I have a page with a button that updates a table in the database. This should affect the data displayed on the page. I've used break points to ensure that the code calling the query to collect...
14
by: Tom.PesterDELETETHISSS | last post by:
Hi, I think this question requires an in depth understanding of how a browser cache works. I hope I can reach an expert here. I may have found a quirk in the asp.net documentation or I don't...
0
by: bthomas71chevy | last post by:
(I hope I can explain this correctly and someone can clarify it and or correct me if I'm wrong?) After a Build of a Web App and deployment, each pages server cache is dropped and that is why the...
0
by: mateipuiu | last post by:
When a try to run a client build on 2005, which uses the Microsoft.ApplicationBlocks.Cache.dll reference, when using a Microsoft.ApplicationBlocks.Cache.dll created on Debug mode, the client works...
5
by: Stan SR | last post by:
Hi, Some newbie questions.. :-) First, what is the namespace to use for the Cache class ? When I use this bit of code I get an error if (Cache==null) Cache.Insert("myUserList",userlist);...
3
by: Henry | last post by:
I have a simple form on a page in my website in which a user can enter an email address to be added to a mailing list. The following ASP script works the first time a user submits his or her...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.