Search Blog and Linked Content

Tuesday, February 1, 2011

NHibernate Cache Providers

When considering which of the cache providers availible in NHibernate, we are presented with a list which includes:

Velocity: Hard to find detailed info on this provider.

Prevalence: An Object based  caching provider which isolates the caching to objects rather than data and queries. See Prevayler.

Memcache: Handles server farms and exploit the additional memory throughout the farms’ multiple servers for use in caching.

SharedCache: Designed to provide redundancy of the cache across a multi-server farm.

SysCache: Standard ASP.NET caching provider which does not exploit the additional memory throughout a server farm.

SysCache2: Similar to SysCache, but also allows for the use of SQL Dependency to triggers cache expiration.

The scope of my problem is a single web server, which eliminates Memcache and SharedCache.

My first choice would be SysCache, as long as we have no external influences on our underlying database which would have a direct impact on the integrity of our cached data. So, if the application has exclusive control over when the data is modified, SysCache sounds like it would be the solution, as there would be no need to listen for changes outside the scope of our application.  The cache provider is supposed to keep track of these types of things.

If there are outside influences to our data, and we need to listen for potential changes that happen OUTSIDE of our application, SysCache2 would be the solution.  You just have to identify all of the tables that may change and configure the dependencies accordingly.

No comments:

Post a Comment