Skip to content

Commit a2e8883

Browse files
committed
use reflector to call OutputCacheUtility.FlushKernelCache method since otherwise it will cause compiler error if the build machine does not have 4.7 installed.
1 parent 48db17b commit a2e8883

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/OutputCacheModuleAsync/OutputCacheHelper.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,14 @@ private async void DependencyRemovedCallback(string key, object value, CacheItem
475475
var dce = value as DependencyCacheEntry;
476476
// Invalidate kernel cache entry
477477
if (dce.KernelCacheUrl != null && IsKernelCacheAPISupported()) {
478-
OutputCacheUtility.FlushKernelCache(dce.KernelCacheUrl);
478+
Assembly System_Web = typeof(ResponseElement).Assembly;
479+
Type OutputCacheUtilityType = System_Web.GetType("System.Web.Caching.OutputCacheUtility");
480+
if (OutputCacheUtilityType != null) {
481+
var flushKernelCacheMethod = OutputCacheUtilityType.GetMethod("FlushKernelCache");
482+
if (flushKernelCacheMethod != null) {
483+
flushKernelCacheMethod.Invoke(dce.KernelCacheUrl, new object[] { });
484+
}
485+
}
479486
}
480487
if (reason == CacheItemRemovedReason.DependencyChanged) {
481488
if (dce.RawResponseKey != null) {

0 commit comments

Comments
 (0)