I'd like to know if I can implement a method on MemoryCache that removes an item from it and add a new one before any other thread tries to reach it. I can't seem to find anything that would let me control the lock(maybe for a good reason) so I can perform these two operations at once.
If you mean "with the same key", then use the indexer:
cache[key] = value;
If you mean with different keys, then: no