views:

23

answers:

1

I've noticed that when I evict things from the session factory, the cmd_flush counter is increased in the memcached server. This makes the caching less useful since it is reset fairly often.

Here's my code that triggers this:

session.SessionFactory.Evict(typeof(Foo));
session.SessionFactory.Evict(typeof(Bar));
session.SessionFactory.EvictQueries(key);

I haven't figured out how NHibernate turns this into a flush_all command yet.

Does anyone have any ideas on how to evict certain object types from the cache without blowing it all away?

A: 

Apparently SessionFactoryImpl.Evict calls Cache.Clear() which calls client.FlushAll().

I ended up tweaking the database design to avoid having to evict objects myself.

David Hogue