HighTechTalks DotNet Forums  

caching driving me crazy, what's going on??

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss caching driving me crazy, what's going on?? in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AndrewW
 
Posts: n/a

Default caching driving me crazy, what's going on?? - 06-29-2005 , 12:57 PM






Hi

Can anyone advise on this please? Something is happening here and it's
driving me mad trying to work out what. For simplicity I've reduced all
code to a simple section running in my applications' Page_Load method:

(in declarations:
Private svcinfo As New serviceInfo
)

Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Cache.Item("ServiceInfo") Is Nothing Then
svcinfo = svcIMS.getServiceInfo
Cache.Insert("ServiceInfo", svcinfo)
Debug.WriteLine("Envelope in the cache is " &
Cache("ServiceInfo").env.ToString)
Else
' got one already thanks, so reload that.
svcinfo = Cache("ServiceInfo")
End If

cE = svcinfo.env
cE.minx = 10
cE.maxx = 20
cE.miny = 100
cE.maxy = 200

Debug.WriteLine("Changed local cE to be " & cE.ToString)
Debug.WriteLine("Envelope now in the cache is " &
Cache("ServiceInfo").env.ToString)
End Sub

And here's the output I get. The initial load in the cache is the value
I want to preserve, it should never be changed.

Envelope in the cache is SW: 166000,828000 : NE 232000,921000
Changed local cE to be SW: 10,100 : NE 20,200
Envelope now in the cache is SW: 10,100 : NE 20,200

The toString function for an Envelope is:
Overrides Function toString() As String
Return String.Format("SW: {0},{1} : NE {2},{3}", _minx, _miny,
_maxx, _maxy)
End Function

How come I have a local copy of what is in the cache (in cE) yet when I
change cE it affects what's in the cache? I don't get it...

Someone put me out of my misery please

Cheers
AW


Reply With Quote
  #2  
Old   
Alvin Bruney [MVP - ASP.NET]
 
Posts: n/a

Default Re: caching driving me crazy, what's going on?? - 06-29-2005 , 06:25 PM






maybe its because the cache stores live object references???

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"AndrewW" <andyjgw (AT) gmail (DOT) com> wrote

Quote:
Hi

Can anyone advise on this please? Something is happening here and it's
driving me mad trying to work out what. For simplicity I've reduced all
code to a simple section running in my applications' Page_Load method:

(in declarations:
Private svcinfo As New serviceInfo
)

Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Cache.Item("ServiceInfo") Is Nothing Then
svcinfo = svcIMS.getServiceInfo
Cache.Insert("ServiceInfo", svcinfo)
Debug.WriteLine("Envelope in the cache is " &
Cache("ServiceInfo").env.ToString)
Else
' got one already thanks, so reload that.
svcinfo = Cache("ServiceInfo")
End If

cE = svcinfo.env
cE.minx = 10
cE.maxx = 20
cE.miny = 100
cE.maxy = 200

Debug.WriteLine("Changed local cE to be " & cE.ToString)
Debug.WriteLine("Envelope now in the cache is " &
Cache("ServiceInfo").env.ToString)
End Sub

And here's the output I get. The initial load in the cache is the value
I want to preserve, it should never be changed.

Envelope in the cache is SW: 166000,828000 : NE 232000,921000
Changed local cE to be SW: 10,100 : NE 20,200
Envelope now in the cache is SW: 10,100 : NE 20,200

The toString function for an Envelope is:
Overrides Function toString() As String
Return String.Format("SW: {0},{1} : NE {2},{3}", _minx, _miny,
_maxx, _maxy)
End Function

How come I have a local copy of what is in the cache (in cE) yet when I
change cE it affects what's in the cache? I don't get it...

Someone put me out of my misery please

Cheers
AW




Reply With Quote
  #3  
Old   
AndrewW
 
Posts: n/a

Default Re: caching driving me crazy, what's going on?? - 07-01-2005 , 05:32 AM



Indeed it does, thanks for that


Reply With Quote
  #4  
Old   
vivek aggarwal
 
Posts: n/a

Default Re: caching driving me crazy, what's going on?? - 07-16-2005 , 07:01 AM



Try This Code on top of your Pages Where u find this Problem

<%@ OutputCache Duration="1" VaryByParam="none"%>

ALso U can Set your web Server Caching refresh frequency.

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.