コード例 #1
0
        public static Forecast CacheExample()
        {
            /*
             * This example will call the default weather service and cache the response for five minutes.
             *
             * All subsequent calls to this endpoint will return the data from the cache if it is still valid.
             */

            var cachePolicy = CachePolicy.GetCachePolicy(15);

            var result = cachePolicy.Execute(context => _weatherService.GetForecast(false), new Context("WeatherKey"));

            return(result);
        }