3

我想知道我是否可以在 MemoryCache 上实现一个方法,从其中删除一个项目并在任何其他线程尝试访问它之前添加一个新项目。我似乎找不到任何可以让我控制锁的东西(也许有充分的理由),所以我可以一次执行这两个操作。

4

1 回答 1

1

If you mean "with the same key", then use the indexer:

cache[key] = value;

If you mean with different keys, then: no

于 2012-04-01T10:17:19.697 回答