Skip to content

ozzymcduff/NHibernate.Caches.StackExchange.Redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NHibernate.Caches.StackExchange.Redis Build status

This is a Redis based ICacheProvider for NHibernate written in C# using StackExchange.Redis.

Installation

  1. NuGet
  2. git submodule add https://github.com/wallymathieu/NHibernate.Caches.StackExchange.Redis.git
  3. Fork and make a submodule (you might want a different version of StackExchange.Redis)
  4. Copy the relevant code (it's MIT)
  5. Private nuget stream (if you are building using appveyor it's quite simple)

Usage

Configure NHibernate to use the custom cache provider:

<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache">true</property>
<property name="cache.provider_class">NHibernate.Caches.Redis.RedisCacheProvider, 
    NHibernate.Caches.Redis</property>

Wire up configuration section in app or web config:

  <configSections>
    <section name="rediscache" type="NHibernate.Caches.StackExchange.Redis.SectionHandler,NHibernate.Caches.StackExchange.Redis" />

And then add the settings:

  <rediscache>
    <cache region="foo_bar" expiration="999" priority="4" />
  </rediscache>

To set the connection settings using c#:

RedisCacheProvider.ConnectionSettings = new RedisCacheConnection("localhost", 6379) { { "allowAdmin", "true" }, { "abortConnect", "false" } };

Happy caching!

About

Code based on https://github.com/TheCloudlessSky/NHibernate.Caches.Redis and forks of that project but made to work with StackExchange Redis instead

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •