gpt4 book ai didi

带有 Web 服务调用的 ASP.NET 缓存

转载 作者:行者123 更新时间:2023-12-02 13:42:46 25 4
gpt4 key购买 nike

Assume that you are developing a web application that shows currency exchange rates for a bank web site. The rates are stored in an IBM Mainframe in the bank and rates are available through web services. Each time a user accesses the rates page, the page makes a request to the mainframe. This generates too much load on the mainframe. Especially most of the time the rates delivered is the same. How would you design a caching architecture that minimises the trip to the web service. But at the same time rates may fluctuate within the day and if rates have changed the rates web page should not display the cached values but make another request to the web service. How would you design such a caching architecture and make sure it is invalidated on rate changes? Please explain by drawing a diagram.

您能告诉我在这种情况下 ASP.net 如何知道值已更改吗?我该怎么办?

最佳答案

“大型机”必须向 Web 通告该值已更改。

例如,您可以实现另一个名为“InvalidateCache()”的 Web 服务,该服务在调用时会清空缓存。

当费率发生变化时,“Mainframe”将调用 InvalidateCache 服务,该服务将清空缓存,以便对费率服务的后续请求将调用 Mainframe 获取新费率。

关于带有 Web 服务调用的 ASP.NET 缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8122467/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com