简体   繁体   中英

asp.net web application, where is a good place to store and reuse values that change frequently?

I have a requirement to create a high performance asp.net web application. The page when requested needs to pull in some financial rates, these rates originate from a legacy system where directly calling it with each page load would result in a substantial performance loss.

My initial idea was to have a cached version of the rates sitting in SQL server and pull from there. This way when rates do change the legacy system can call a web service which can update this SQL table.

Still I wasn't happy leaving it like that - this would mean a lookup to SQL with each page request.

I started thinking about using a global variable. To hold the rates. But then I was left wondering how the legacy system is going to update the asp.net web application global variable value. This could get tricky.

So what is the best approach given performance is key. I'm thinking that call to SQL server might not be a bad idea, since it will be a straight table select. But then again - maybe there is another way to do this which is better?

Thanks in advance....

You can cache using SqlCacheDependency . So no need to worry about updating data. Once your data is changed in the database, it will reset the cache and then next request will rebuild the cache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM