如何在ASP.NET 3.5中进行per-http请求缓存 [英] How to make per- http Request cache in ASP.NET 3.5

查看:106
本文介绍了如何在ASP.NET 3.5中进行per-http请求缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用ASP.NET 3.5(基于控件的方法),并且只需要具有针对一个http请求的存储空间.

We using ASP.NET 3.5 (Controls-based approach) and need to have storage specific for one http request only.

具有来自会话ID的键的特定于线程的缓存将不起作用,因为应该将线程池化,因此我有机会将来自某些先前请求的数据存储在缓存中,这在我的情况下是不希望的.我始终需要为整个请求中可用的每个请求提供全新的存储空间.

Thread-specific cache with keys from session id won't work because threads are supposed to be pooled and therefore I have a chance to have data from some previous request in cache, which is undesirable in my case. I always need to have brand new storage for each request available through whole request.

有什么想法如何在ASP.NET 3.5中实现吗?

Any ideas how to do it in ASP.NET 3.5?

推荐答案

我们使用了

We have used HttpContext.Current.Items collection to do RequestScope caching. It works well.

这篇关于如何在ASP.NET 3.5中进行per-http请求缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆