Cloned Cached item has memory issues
Posted
by ioWint
on Stack Overflow
See other posts from Stack Overflow
or by ioWint
Published on 2010-03-30T04:43:47Z
Indexed on
2010/03/30
4:53 UTC
Read the original article
Hit count: 363
Hi there, we are having values stored in Cache-Enterprise library Caching Block. The accessors of the cached item, which is a List, modify the values. We didnt want the Cached Items to get affected.
Hence first we returned a new List(IEnumerator of the CachedItem) This made sure accessors adding and removing items had little effect on the original Cached item.
But we found, all the instances of the List we returned to accessors were ALIVE! Object relational Graph showed a relationship between this list and the EnterpriseLibrary.CacheItem.
So we changed the return to be a newly cloned List. For this we used a LINQ say (from item in Data select new DataClass(item) ).ToList() even when you do as above, the ORG shows there is a relationship between this list and the CacheItem.
Cant we do anything to create a CLONE of the List item which is present in the Enterprise library cache, which DOESNT have ANY relationship with CACHE?!
© Stack Overflow or respective owner