fluent nhibernate not caching queries in asp.net mvc

Posted by AWC on Stack Overflow See other posts from Stack Overflow or by AWC
Published on 2010-05-07T13:43:45Z Indexed on 2010/05/07 13:48 UTC
Read the original article Hit count: 243

Filed under:
|
|

I'm using a fluent nhibernate with asp.net mvc and I not seeing anything been cached when making queries against the database. I'm not currently using an L2 cache implementation.

Should I see queries being cached without configuring an out of process L2 cache?

Mapping are like this:

 Table("ApplicationCategories");
 Not.LazyLoad();
 Cache.ReadWrite().IncludeAll();
 Id(x => x.Id);
 Map(x => x.Name).Not.Nullable();
 Map(x => x.Description).Nullable();

Example Criteria:

 return session
          .CreateCriteria<ApplicationCategory>()
          .Add(Restrictions.Eq("Name", _name))
          .SetCacheable(true);

Everytime I make a request for an application cateogry by name it is hitting the database is this expected behaviour?

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about caching