Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前在 wcf restful 服务中有 2 个静态词典。它们都保存了不值得放入数据库的查找数据。这些将保留在内存中直到应用程序重新启动还是应该将它们放在 HttpContext.Current.Application 中?
静态数据将一直保留到进程回收或停止,与 HttpContext.Current.Application 相同。
如果您正在寻找更复杂的缓存选项,请查看 4.0 中引入的 System.Runtime.Caching 命名空间。它易于使用,适用于任何 .NET 应用程序,并提供设置过期时间和创建回调函数以在过期时执行等功能。