They use it for returned objects, but requests go directly to db unless you use a second level cache.
Consider this:
var fooUsingGet = session.Get<Foo>(fooId); var fooQueryById = session.Query<Foo>().Single(f => f.Id == fooId);
Two queries are executed (one for Get, one for the query), but both variables contain the same object reference.
Now, if you enable the second level cache, do query caching and specify caching for the request:
var fooQueryById = session.Query<Foo>().Cacheable() .Single(f => f.Id == fooId); var fooQueryByIdAgain = session.Query<Foo>().Cacheable() .Single(f => f.Id == fooId);
Only one request is executed.
source share