Posted on: 5/12/2011 2:59:08 PM | Views : 234

Hi, I have a function called GetAllProducts() which fetches all products from my database and stores them in the cache for 30 mins. This has been working fine, until just now I have added another function called SearchProducts() which calls the GetAllProducts() method and then removes products it does not need. I am finding after I run the SearchProducts() method, the GetAllProducts() cache has been updated to the search products results. How can I stop this happening?
 
Public Shared Function GetAllProducts() As ProductCollection Dim Products As New ProductCollection() If IsNothing(System.Web.HttpContext.Current.Cache("ProductData")) Then '////// Database code to get products goes here ////// System.Web.HttpContext.Current.Cache.Insert("ProductData", Products, Nothing, DateTime.Now.AddMinutes(5), TimeSpan.Zero) End If Products = System.Web.H ...

Go to the complete details ...