ASP.net 创建自重新缓存对象?
当缓存过期时,如何使缓存对象使用更新的信息重新缓存自身?我试图阻止下一个请求缓存的用户必须处理获取设置缓存的数据,然后使用它是否有任何后台方法/事件我可以将对象绑定到,以便当它过期时它只调用该方法它自我和自我缓存。
How can i make a cached object re-cache it self with updated info when the cache has expired? I'm trying to prevent the next user who request the cache to have to deal with getting the data setting the cache then using it is there any background method/event i can tie the object to so that when it expires it just calls the method it self and self-caches.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用缓存中的回调
You can use callback from Cache
请原谅我,也许我错过了一些东西。但听起来您想要不断更新缓存的数据。 IMO,在这种情况下最好使用 CacheDependency 而不是过期。当然,您必须在下一个请求时重新缓存它。
Pardon me, maybe I'm missing something. But the sounds like you are after to keep update the cached data. IMO, it's better to use
CacheDependency
instead of expiration in this case. Of course, you have to re-cache it on the next request.