Why does Cache.Add return an object that represents the cached item?
- by Pure.Krome
From MSDN about the differences between Adding or Inserting an item the ASP.NET Cache:
Note: The Add and Insert methods have
the same signature, but there are
subtle differences between them.
First, calling the Add method returns an object that represents the
cached item, while calling Insert does
not. Second, their behavior is
different if you call these methods
and add an item to the Cache that is
already stored there. The Insert
method replaces the item, while the
Add method fails. [emphasis mine]
The second part is easy. No question about that.
But with the first part, why would it want to return an object that represents the cached item? If I'm trying to Add an item to the cache, I already have/know what that item is?
I don't get it. What is the reasoning behind this?