diff --git a/StackExchangeRedis/NHibernate.Caches.StackExchangeRedis/DefaultCacheRegionStrategyFactory.cs b/StackExchangeRedis/NHibernate.Caches.StackExchangeRedis/DefaultCacheRegionStrategyFactory.cs index b1a2866..0433f57 100644 --- a/StackExchangeRedis/NHibernate.Caches.StackExchangeRedis/DefaultCacheRegionStrategyFactory.cs +++ b/StackExchangeRedis/NHibernate.Caches.StackExchangeRedis/DefaultCacheRegionStrategyFactory.cs @@ -19,6 +19,18 @@ public virtual AbstractRegionStrategy Create(IConnectionMultiplexer connectionMu { return new FastRegionStrategy(connectionMultiplexer, configuration, properties); } + + if (configuration.RegionStrategy == typeof(FastTwoLayerCacheRegionStrategy) || + configuration.RegionStrategy == typeof(TwoLayerCacheRegionStrategy) || + configuration.RegionStrategy == typeof(DistributedLocalCacheRegionStrategy)) + { + throw new CacheException( + $"{configuration.RegionStrategy} is not supported by {GetType()}, register " + + $"a custom {typeof(ICacheRegionStrategyFactory)} or use a supported one. " + + $"{configuration.RegionStrategy} requires an application provided implementation " + + $"of {nameof(RegionMemoryCacheBase)} and cannot be directly supported by the " + + $"{nameof(DefaultCacheRegionStrategyFactory)}."); + } throw new CacheException( $"{configuration.RegionStrategy} is not supported by {GetType()}, register " +