I'm building a cache provider for Redis for a distributed environment. I 
think I've found a bug in each of the NHibernate.Contrib's cache providers 
that are meant to be distributed.

Here's my relevant StackOverflow 
post: http://stackoverflow.com/q/12542378/200322

Basically, when ISessionFactory is Disposed/Closed, it calls Destroy() on 
all of the cache providers. The providers that are meant to be distributed, 
for example Memcached, call Clear() when Destroy() is called. Therefore, *every 
time* an ISessionFactory is disposed of, the *whole NHibernate cache is 
cleared*. Additionally, a Hibernate Memcached provider that I found *does 
not call clear()* when destory() is called (in fact there's a comment about 
it in destroy()).

I hardly think that this is ideal because since it would cause the whole 
cache to be invalidated when taking down *one *web server (a restart/update 
etc).

Could someone please explain this reasoning? 

Reply via email to