O'Reilly logo

Programming Reactive Extensions and LINQ by Paul Betts, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Memorizing and Caching in ReactiveUI

One thing that is useful in any kind of programming is having a look-up table so that you don't have to spend expensive calls to fetch the same data that you just had recently, since fetching the data and passing it around via parameters often gets ugly.

A better way is to use a cache; that is, to store values we've fetched recently and reuse them. A naive approach would be to store the data off in a simple Dictionary. This might work for a while, but you soon realize, as Raymond Chen, Microsoft's principal software design engineer, says, “Every cache has a cache policy, whether you know it or not.”

In the case of a Dictionary, the policy is unbounded—an unbounded cache is a synonym for “memory leak,” since ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required