Cloned Cached item has memory issues
- by ioWint
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?!