From b7a0b007e43c699d3ab2a6cf9ae12b227a36e3c3 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 23 Sep 2015 16:14:19 -0700 Subject: [PATCH] [Fixes #5835] Restoring cache invalidation propagation --- src/Orchard/Caching/ICacheManager.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Orchard/Caching/ICacheManager.cs b/src/Orchard/Caching/ICacheManager.cs index 785d34f0c..793b29a46 100644 --- a/src/Orchard/Caching/ICacheManager.cs +++ b/src/Orchard/Caching/ICacheManager.cs @@ -7,11 +7,11 @@ namespace Orchard.Caching { } public static class CacheManagerExtensions { - public static TResult Get(this ICacheManager cacheManager, TKey key, bool lazy, Func, TResult> acquire) { - // Wrap the call in a Lazy initializer to prevent multiple processes from - // executing the same lambda in parallel. - if (lazy) { - return cacheManager.Get>(key, k => new Lazy(() => acquire(k))).Value; + public static TResult Get(this ICacheManager cacheManager, TKey key, bool preventConcurrentCalls, Func, TResult> acquire) { + if (preventConcurrentCalls) { + lock(key) { + return cacheManager.Get(key, acquire); + } } else { return cacheManager.Get(key, acquire);