MSDN图书馆关于某类文件的“校对安全”部分:
Any instance members are not guaranteed to be thread safe.
这非常正常。 NET课程,文件夹,在几个选定的案例中没有格式。 在文件更新之前,记忆中心也是如此。 达维德连接的“连接反馈”条款有助于澄清这一点:
System.Runtime.Caching.MemoryCache is threadsafe. Multiple concurrent
threads can read and write a MemoryCache instance. Internally
thread-safety is automatically handled to ensure the cache is updated
in a consistent manner.
What this might be referring to is that data stored within the cache
may itself not be threadsafe. For example if a List is placed in
the cache, and two separate threads both get a reference to the cached
List, the two threads will end up stepping on each other if they
both attempt to update the list simultaneously.