Groups | Blog | Home
all groups > asp.net caching > october 2004 >

asp.net caching : object updating cache


dappledore NO[at]SPAM kagi.com
10/17/2004 7:40:18 AM
Dim col As New uTargetAdvertiserURLCollection(Cache("UtargetCampaigns"))



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

Ben Strackany
11/22/2004 2:03:01 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>


[quoted text, click to view]

AddThis Social Bookmark Button