HighTechTalks DotNet Forums  

object updating cache

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


Discuss object updating cache in the ASP.net Caching forum.



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

Default object updating cache - 10-17-2004 , 10:40 AM






Dim col As New uTargetAdvertiserURLCollection(Cache("UtargetCampa igns"))



Dim item As uTargetAdvertiserURL

item = col.Item(0)

item.URLID += 1

Response.Write(item.URLID)

item = Nothing

When i update the item which is part of a collection , it also updates
the cache. This must be because the collection is pointing to the
cache object. I want to pass a copy of the cache object to the
collection , i dont want it updating the actual cache object. I have
tried passing in as a parameter to the collection constructor and copy
all the items into the list, this still updates the cache .
The collection inherits from collectionbase and implements
ibindinglist , list.
The item is just a wrapper with properties and fields

David

Reply With Quote
  #2  
Old   
Ben Strackany
 
Posts: n/a

Default Re: object updating cache - 11-22-2004 , 03:03 PM






Yes, what's in cache is just a reference. So if you get an object out of
cache & update it, it'll update what's "cached". Maybe try cloning what's in
cache & updating the clone.

--
Ben Strackany
www.developmentnow.com

<a href="http://www.developmentnow.com">dn</a>


"dee" <dappledore (AT) kagi (DOT) com> wrote

Quote:
Dim col As New uTargetAdvertiserURLCollection(Cache("UtargetCampa igns"))



Dim item As uTargetAdvertiserURL

item = col.Item(0)

item.URLID += 1

Response.Write(item.URLID)

item = Nothing

When i update the item which is part of a collection , it also updates
the cache. This must be because the collection is pointing to the
cache object. I want to pass a copy of the cache object to the
collection , i dont want it updating the actual cache object. I have
tried passing in as a parameter to the collection constructor and copy
all the items into the list, this still updates the cache .
The collection inherits from collectionbase and implements
ibindinglist , list.
The item is just a wrapper with properties and fields

David



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.