I've been reading Hibernate in action book and found out that I can configure 2nd level cache regions for each class and collection. Book says that I need to create a region with a "special" name and I could tune 2nd level cache expiration there.
The question is how to understand which region name to use? In Hibernate in action they used a full name of the class with the namespace. And for collections they just added the name of the collection. Is it the same in NHibernate? Is this example is valid? (I am using SysCache provider for the 2nd level cache)
Code:
public namespace MyNamespace
{
public class MyEntity
{
public IList<int> MyCollection;
}
}
<syscache>
<cache region="MyNamespace.MyEntity" expiration="20" priority="3"/>
<cache region="MyNamespace.MyEntity.MyCollection" expiration="10" priority="1"/>
</syscache>
And another question is about using concurrency strategy. The book says that I can use a file with the name hibernate.cfg.xml to set concurrency strategies for the each class and collection. Is the naming is the same (Namespace.ClassName[.Collection])?
Can I use both web.config and hibernate.cfg.xml? I would like to use web.config for main parameters like connection string, providers and so on and hibernate.cfg.xml just for 2nd level cache tuning.