Alvin Bruney [ASP.NET MVP]
1/21/2009 12:21:00 AM
That will only work if the cache is the global cache. If the cache is the
session store or viewstate, it won't persist. There's a potential for
confusion between names that can lead to misinterpretation.
--
Regards,
Alvin Bruney
Auther Plug
OWC Blackbook now on download at www.lulu.com/owc
"yanni" <yanni66cn@126.com> wrote in message
news:OkBJzQkdJHA.3864@TK2MSFTNGP05.phx.gbl...
> Funny, I did the test, after I changed object from cache, but not put it
> back, I read it from another browser session, the updated value shows up
> there...
>
> "Rich Armstrong" <RichA24@nospam.nospam> wrote in message
> news:18889212-7454-4056-A760-3ACA9C5564CD@microsoft.com...
>>> It depends on whether your class is a reference type or value type. For
>>> reference type, any instance of them are passed and held as a
>>> reference(like pointer in C/C++). Therefore, what you store into Cache
>>> collection is that handle/reference. Whenever you make any changes on
>>> any
>>> reference variable(pointing to that object instance), all the other
>>> reference/handle pointing to the same instance will see the changes.
>>
>> I was speaking only of class objects (the post begins, "If one were to
>> retrieve a cached class object ...") which, I thought, were reference
>> types by definition. How can a class (vs. a struct) be a value type? I
>> thought that defining a type as a class is what _makes_ it a reference
>> type.
>>
>> In any case, the behavior I'm seeing in our application is consistent
>> with Alvin Bruney's statement in his earlier post, "... if you retrieve
>> and change the object, you need to put it back in cache, not for the sake
>> of preserving the value, but for the sake of caching the object so it can
>> be available to other callers." What's confusing here is the suggestion
>> that the (reference type's) changed value can be "preserved," without
>> being "available to other callers."
>
>