public void Cache() { var input = Reactive.Variable(2); //We define a reactive variable. Func <int> f = () => //f is the calculation we want to cache. { Console.WriteLine("cache miss"); return(input * input); //f depends on our reactive variable 'input'. }; var cache = Reactive.Cache(f); //We base our cache on f. Assert.AreEqual(4, cache.Get()); //Prints 'cache miss' Assert.AreEqual(4, cache.Get()); //Cache hit. input.Value = 3; //Cache becomes stale. Assert.AreEqual(9, cache.Get()); //Prints 'cache miss' Assert.AreEqual(9, cache.Get()); //Cache hit. }