gpt4 book ai didi

c# - 如何获取 IMemoryCache 中 key 的 AbsoluteExpiration DateTimeOffset

转载 作者:行者123 更新时间:2023-12-03 10:01:13 28 4
gpt4 key购买 nike

我向 IMemoryCache 添加一个值

_cache.Set("Key", "Value", DateTimeOffset.UtcNow);

我想通过其他方法获取这个key的绝对过期值。

或者

我想在不更改到期时间的情况下更新此 key 的值。

我该怎么做?

In IMemoryCache document doesn't have any way to get it (at least i didn't see), I handle it by caching expiration. Is there any better solution for handle it?

最佳答案

IMemoryCache(如在其 documentation 中)没有任何方法来获取项目过期时间。其默认实现相同 MemoryCache .

关于c# - 如何获取 IMemoryCache 中 key 的 AbsoluteExpiration DateTimeOffset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61175442/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com