what happens if an user trying to read HttpContext.Current.Cache[key] while the other one trying to remove object HttpContext.Current.Cache.Remove(key) at the same time?
Just think about hundreds of users reading from cache and trying to clean some cache objects at the same time. What happens and is it thread safe?
Is it possible to create database aware business objects in cache?
If the code is unable to get the object, then nothing / null is returned.
Why would you bother to cache an object if you would have the chance of removing it so frequently? Its better to set an expiration time and reload the object if its no longer in the cache.
Can you explain ‘DB aware object’? Do you mean a sql cache dependency, or just an object that has information about a db connection?
EDIT: Reponse to comment #3.
I think we are missing something here. Let me explain what I think you mean, and you can tell me if its right.
If this is the case, then you dont need a Sql Cache dependency.