I'm currently trying to get a 2nd level cache running correctly. I started using SysCache2 but got nowhere. Then I switched back to SysCache because I figured cache expiration can wait until I got the caching right in the first place. So after long try-and-error I got SysCache working the way I wanted it.

More spefically I have a parent child relationship, where the child objects are eagerly fetched with a subselect. Furthermore, I made the following changes:

So with the first request I see two SELECT statements and after that no more selects until the cache expired. After that I see the same two SELECT statements again that were submitted in the beginning.

Now to my problem. I'd really like to use the SqlDependency features supported by SysCache2. But if I switch over to SysCache2 some "things" don't seem to get cached. The first request results in the same two SELECT statements. But then for the second request NHibernate requeries every single parent object and its child objects so I have 2 * nParent queries.

From what I remember I saw a similar behavior using SysCache when I did not specify the cache regions correctly during my try-and-error phase. This was because query results and record data then timed out at different times. But I'm not sure whether it was EXACTLY the same problem/behavior.

I doubt that it has something to do with cache expiry notifications received from a SqlDependency. If there was an expiration I'd expect that NHibernate just submits the two SELECT statements from before. Additionally, since everything is tied to the KnowledgeRegion region, everything should expire. But here it seems the query results are still available but the object data is not.

So, my question is did I do anything wrong or forget something when switching to SysCache2 or is there a problem in SysCache2?