What is difference between MemoryCache vs ObjectCache in .net 4.0?

前端 未结 3 2087
不思量自难忘°
不思量自难忘° 2021-02-02 05:35

What is difference between .NET framework 4.0 MemoryCache vs ObjectCache? Where to use which object?

3条回答
  •  [愿得一人]
    2021-02-02 06:29

    ObjectCache is an abstract class, you can't 'use' it per se. As Dash says in his comment, it's designed to show how a cache should be built and what operations it supports. MemoryCacheis an implementation of ObjectCache and from your question is likely what you should use. However, because ObjectCache is abstract, you could just as easily write your own FileCache inheriting from ObjectCache and it would be perfectly valid.

提交回复
热议问题