Skip to content

How to use NHibernate.Caches.StackExchangeRedis.TwoLayerCacheRegionStrategy #123

@EngSayed

Description

@EngSayed

According to the documentation

cache.strategy can take one of many values and one of them is NHibernate.Caches.StackExchangeRedis.TwoLayerCacheRegionStrategy

When I try to configure it in the cache region configuration inside Web.config as following:
<cache region="community" strategy="NHibernate.Caches.StackExchangeRedis.TwoLayerCacheRegionStrategy, NHibernate.Caches.StackExchangeRedis" />

Then I get the following exception:

NHibernate.Caches.StackExchangeRedis.TwoLayerCacheRegionStrategy is not supported by NHibernate.Caches.StackExchangeRedis.DefaultCacheRegionStrategyFactory, register a custom NHibernate.Caches.StackExchangeRedis.ICacheRegionStrategyFactory or use a supported one.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: NHibernate.Cache.CacheException: NHibernate.Caches.StackExchangeRedis.TwoLayerCacheRegionStrategy is not supported by NHibernate.Caches.StackExchangeRedis.DefaultCacheRegionStrategyFactory, register a custom NHibernate.Caches.StackExchangeRedis.ICacheRegionStrategyFactory or use a supported one.

[CacheException: NHibernate.Caches.StackExchangeRedis.TwoLayerCacheRegionStrategy is not supported by NHibernate.Caches.StackExchangeRedis.DefaultCacheRegionStrategyFactory, register a custom NHibernate.Caches.StackExchangeRedis.ICacheRegionStrategyFactory or use a supported one.]
   NHibernate.Caches.StackExchangeRedis.DefaultCacheRegionStrategyFactory.Create(IConnectionMultiplexer connectionMultiplexer, RedisCacheRegionConfiguration configuration, IDictionary`2 properties) +305
   NHibernate.Caches.StackExchangeRedis.RedisCacheProvider.BuildCache(RedisCacheRegionConfiguration regionConfiguration, IDictionary`2 properties) +79
   NHibernate.Caches.StackExchangeRedis.RedisCacheProvider.BuildCache(String regionName, IDictionary`2 properties) +333
   NHibernate.Cache.CacheFactory.BuildCacheBase(String name, Settings settings, IDictionary`2 properties) +44

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions