private void OnUpdateRequestCache(object sender, EdgeCacheEventArgs e) { EdgeCacheRule rule = (EdgeCacheRule)sender; HttpContext context = e.Context; HttpResponse response = context.Response; HttpRequest request = context.Request; OutputCacheKeyBuilder keyBuilder = new OutputCacheKeyBuilder(context); if (response.StatusCode != 200) { return; } DynamicInvoke invoker = new DynamicInvoke(response); if (!(bool)invoker.Call("IsBuffered")) { return; } if (rule.Debug) { response.Write("\r\n<!--Served from edge at " + TimeStamp + " by rule " + rule.Name + "-->"); response.AddHeader("X-Edge-Modified", TimeStamp); response.AddHeader("X-Edge-Rule", rule.Name); } object rawResponse = invoker.Call("GetSnapshot"); string cacheKey = keyBuilder.GetResponseCacheKey(rule.CacheKeyStamp(context)); CacheDependency dependency = new CacheDependency(null, new string[] { DependencyKeyFromRule(rule) }); OutputCacheSnapshot snapshot = new OutputCacheSnapshot(rawResponse); DateTime expiry = rule.AbsoluteExpiry; HttpRuntime.Cache.Add(cacheKey, snapshot, dependency, expiry, Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); }