Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loosing cache !!

Status
Not open for further replies.

Ologhai

Programmer
Apr 11, 2000
42
0
0
CA
Hi all,

i've a problem with caching dataset,

i put this in application start to load dataset in cache memory.

Dim AD As New AgencyData()
Dim ds As DataSet = AD.AgencyCustomerList()

If IsNothing(Context.Cache.Get("AgencyCustomer")) Then
Context.Cache.Insert("AgencyCustomer", ds)
Else
Context.Cache.Item("AgencyCustomer") = ds
End If

this procedure is update every 20 min.

Dim aTimer As New System.Timers.Timer(1200000)
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
aTimer.AutoReset = True
aTimer.Enabled = True

Private Sub OnTimedEvent(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
Dim AD As New AgencyData()
Dim ds As DataSet = AD.AgencyCustomerList()

Context.Cache.Item("AgencyCustomer") = ds
End Sub

ok now my dataset is in my cache, i bind a datagrid on it, all work perfectly,

but after 1 or 2 min i lost my cache, and i wanna know why ?
to resolve it , i check if the "AgencyCustomer" is equal to nothing and i reload it, but it's not a solution for me. My dataset supose to be there until IIS retart.

someone can help me !!

thanks.
--------------------------------
Hugues Gauthier, DEC
Développeur Web

Intelligence Digital
1751 Richardson
Suite 4230
Montréal, Québec
H3K 1G6

hgauthier@intelligencedgt.com
hugues_gauthier@hotmail.com

-------------------
ICQ: 2151800
 
Hugues: I'm just a techncial level kind of person but here's a thought or two.

The cache is strongly dependent on available server resources and is proned to be wiped out by garbage collection if resources are up. From what I can remember from earlier reading I think one approach might be to set the priority higher on the cache item or increase your decay enumeration, e.g., here's an example from one of my books that sets a high priority (less likely to be removed) and slow decay (enumeration):

Cache.Insert ("myItem", _
"Hello", _
Nothing, _
Cache.NoAbsoluteExpiration, _
Cache.NoSlidingExpiration, _
CacheItemPriotity.High, _
CacheItemPriorityDecay.Slow, _
Nothing)

...just an idea or two.
 
Thanks Isadore

i set my cache with no expiration and priority high and it's work fine..


Dim Priority As Caching.CacheItemPriority
Context.Cache.Insert("AgencyCustomer", _
ds, _
Nothing, _
Context.Cache.NoAbsoluteExpiration, _
Context.Cache.NoSlidingExpiration, _
Priority.High, _
Nothing)
--------------------------------
Hugues Gauthier, DEC
Développeur Web

Intelligence Digital
1751 Richardson
Suite 4230
Montréal, Québec
H3K 1G6

hgauthier@intelligencedgt.com
hugues_gauthier@hotmail.com

-------------------
ICQ: 2151800
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top