IIS6 ASP.NET 2.0 Application Cache - data storage options and performance for large amounts of data

走远了吗. 提交于 2019-12-06 02:24:19

1000 is not a large amount of data; that will work fine, but you will need to think about synchronization if this data is shared between requests. In reality a lock to make access to a Dictionary<string,string> is probably fine, although you can be more fine-grained if you need.

However, the inbuilt web cache (HttpContext.Cache) will also approach this same problem, and has all the thread-safety built in.

Don't use SortedDictionary<,> unless you have a care that the data is sorted. I don't think you do.

As numbers get larger, I'd be more inclined to think about stores such as redis / memcached, with local memory as a local shortcut.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!