Is it possible to use ASP.NET application caching in web API?

后端 未结 4 1492
北荒
北荒 2021-01-19 23:15

For example, in a ASP.NET page you would do something like

Cache.Add({...}) and access it via Cache[\"key\"]. In this context, Cache is th

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-20 00:00

    You need to type

    HttpContext.Current.Cache
    

    to access the instance. There is no Cache property declared at the Controller level, like on a Page.

    Note that the context that hosts the API will need to support caching.

提交回复
热议问题