J
Joe Fallon
I have a class which is stored in the cache.
When I retrieve it from cache I return a clone of the class so that I do not
keep a reference to the cached item. (That is the theory anyway.)
When I modify the cloned object and then navigate to another page, the data
in the cache is modified with my changes anyway!
So when I go to another page and expect a "clean" copy of my class to be
retrieved from the cache, it is "dirty" with the changes made on a different
page.
Can someone please explain what is happening here?
I thought that returning a clone would break the reference to the cached
object.
I would hate to have to abandon this technique, but if it doesn't work....
When I retrieve it from cache I return a clone of the class so that I do not
keep a reference to the cached item. (That is the theory anyway.)
When I modify the cloned object and then navigate to another page, the data
in the cache is modified with my changes anyway!
So when I go to another page and expect a "clean" copy of my class to be
retrieved from the cache, it is "dirty" with the changes made on a different
page.
Can someone please explain what is happening here?
I thought that returning a clone would break the reference to the cached
object.
I would hate to have to abandon this technique, but if it doesn't work....