加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何在asp.net核心中检索内存缓存键列表?

发布时间:2020-12-15 23:40:11 所属栏目:百科 来源:网络整理
导读:要简洁.是否可以在.Net Core Web应用程序中列出内存缓存中的所有注册密钥? 我在IMemoryCache界面中找不到任何东西. 解决方法 目前,IMemoryCache接口中没有此类方法可以返回所有缓存键.根据 this github issue评论,我认为将来不会添加. 引用Eilons评论 I thi
要简洁.是否可以在.Net Core Web应用程序中列出内存缓存中的所有注册密钥?

我在IMemoryCache界面中找不到任何东西.

解决方法

目前,IMemoryCache接口中没有此类方法可以返回所有缓存键.根据 this github issue评论,我认为将来不会添加.

引用Eilons评论

I think it’s doubtful this would be available because part of the idea
with caching is that mere moments after you ask it a question,the
answer could have changed. That is,suppose you have the answer to
which keys are there – a moment later the cache is purged and the list
of keys you have is invalid.

如果您需要密钥,则应在将项目设置为缓存时维护应用程序中的密钥列表,并根据需要使用该密钥.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读