@@ -95,11 +95,8 @@ public void HandleEntityNotFound(string entityName, object id)
95
95
private static readonly IIdentifierGenerator UuidGenerator = new UUIDHexGenerator ( ) ;
96
96
97
97
[ NonSerialized ]
98
- // 6.0 TODO: type as CacheBase instead
99
- #pragma warning disable 618
100
- private readonly ConcurrentDictionary < string , ConcurrentDictionary < string , ICache > > allCachePerRegionThenType =
101
- new ConcurrentDictionary < string , ConcurrentDictionary < string , ICache > > ( ) ;
102
- #pragma warning restore 618
98
+ private readonly ConcurrentDictionary < string , ConcurrentDictionary < string , CacheBase > > allCachePerRegionThenType =
99
+ new ConcurrentDictionary < string , ConcurrentDictionary < string , CacheBase > > ( ) ;
103
100
104
101
[ NonSerialized ]
105
102
private readonly IDictionary < string , IClassMetadata > classMetadata ;
@@ -1078,7 +1075,9 @@ public IDictionary<string, ICache> GetAllSecondLevelCacheRegions()
1078
1075
// ToArray creates a moment in time snapshot
1079
1076
. ToArray ( )
1080
1077
// Caches are not unique per region, take the first one.
1081
- . ToDictionary ( kv => kv . Key , kv => kv . Value . Values . First ( ) ) ;
1078
+ #pragma warning disable 618
1079
+ . ToDictionary ( kv => kv . Key , kv => ( ICache ) kv . Value . Values . First ( ) ) ;
1080
+ #pragma warning restore 618
1082
1081
}
1083
1082
1084
1083
// 6.0 TODO: return CacheBase instead
@@ -1102,17 +1101,15 @@ private CacheBase BuildCache(string cacheRegion, string type)
1102
1101
var prefix = settings . CacheRegionPrefix ;
1103
1102
if ( ! string . IsNullOrEmpty ( prefix ) )
1104
1103
cacheRegion = prefix + '.' + cacheRegion ;
1105
- #pragma warning disable 618
1106
- var cachesPerType = allCachePerRegionThenType . GetOrAdd ( cacheRegion , cr => new ConcurrentDictionary < string , ICache > ( ) ) ;
1107
- #pragma warning restore 618
1108
- var cache = settings . CacheProvider . BuildCache ( cacheRegion , properties ) ;
1104
+ var cachesPerType = allCachePerRegionThenType . GetOrAdd ( cacheRegion , cr => new ConcurrentDictionary < string , CacheBase > ( ) ) ;
1105
+ var cache = settings . CacheProvider . BuildCache ( cacheRegion , properties ) . AsCacheBase ( ) ;
1109
1106
if ( ! cachesPerType . TryAdd ( type , cache ) )
1110
1107
{
1111
1108
cache . Destroy ( ) ;
1112
1109
throw new InvalidOperationException ( $ "A cache has already been built for region { cacheRegion } and type { type } .") ;
1113
1110
}
1114
1111
1115
- return cache . AsCacheBase ( ) ;
1112
+ return cache ;
1116
1113
}
1117
1114
1118
1115
/// <summary> Statistics SPI</summary>
0 commit comments