Skip to content

Commit

Permalink
Throw a more explanatory error with the advanced strategies (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericDelaporte authored May 10, 2024
1 parent 71e9fe8 commit 068e629
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 " +
Expand Down

0 comments on commit 068e629

Please sign in to comment.