Automatically re-populate the cache at expiry time

前端 未结 4 1161
悲哀的现实
悲哀的现实 2021-02-09 14:52

I currently cache the result of a method invocation.

The caching code follows the standard pattern: it uses the item in the cache if it exists, otherwise it calculates t

4条回答
  •  独厮守ぢ
    2021-02-09 15:24

    Since this is ASP.NET, the Cache.Insert() method allows you to specify a callback delegate.

    Does this sound like a sensible approach?

    Yes, the callback (and File-dependency) are supplied for exactly this kind of situation. You still have ro make a trade of between resources, latency and out-of-dateness.

提交回复
热议问题