Is it possible to configure expiration of NHibernate’s query cache?
For second level cache I can do it from nhibernate.cfg.xml, but I can’t find a way for SQL query cache.
EDIT:
ICriteria query = CreateCriteria()
.Add(Expression.Eq("Email", identifiant))
.SetCacheable(true)
.SetCacheRegion("X");
<syscache>
<cache region="X" expiration="10" priority="1" />
</syscache>
Yes, we can set cache expiration via region. Adjust the query like this:
And put similar configuration into web.config file
EDIT: I am just adding this link Class-cache not used when getting entity by criteria
To be sure what I mean by SQL Query cache. In the linked answer I am explaining that topic
Just for a clarity. The configuration of the NHibernate “session-factory” must contain:
This switch will make query cache working. More details: http://nhibernate.info/doc/nh/en/index.html#performance-querycache