title: Fluent nHibernate - Query Cache not working with "session.Query" and Cacheable()
body: <p>Did't get any QueryCacheHitCount. The Source Code looks like:
  nHibernate 3.3.1.4000, FluentnHibernate 1.3.0.733</p>
  
  <p>Config:</p>
  
  <pre><code>Factory = Fluently.Configure()
      .ExposeConfiguration(c =&gt;
          c.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, "true"))
      .Database(
      MsSqlConfiguration.MsSql2008.ConnectionString(c =&gt; c.Is("DATA SOURCE=localhost;PERSIST SECURITY INFO=True;USER ID=AAA;Password=AAA"))
              .ShowSql()
      )
      .Mappings(x =&gt; x.FluentMappings.AddFromAssemblyOf&lt;Localization.NHibernate.Article&gt;())
      .ExposeConfiguration(BuildDatabase)
      .Cache(
          x =&gt; x.UseSecondLevelCache()
                  .UseQueryCache()                         
                  .ProviderClass&lt;NHibernate.Cache.HashtableCacheProvider&gt;())
      .BuildSessionFactory();
  </code></pre>
  
  <p>Execute:</p>
  
  <pre><code>using (var tx = session.BeginTransaction())
  {
      Factory.Statistics.Clear();
  
      for (int i = 0; i &lt; 10; i++)
      {
          Article s = session.Query&lt;Article&gt;().Cacheable().Where(x =&gt; x.Name == "O").SingleOrDefault();
      }
  
      Console.WriteLine(Factory.Statistics.QueryCacheHitCount);
      Console.WriteLine(Factory.Statistics.SecondLevelCacheHitCount);
      Console.WriteLine(Factory.Statistics.QueryExecutionCount);
  }
  </code></pre>
  
  <hr>
  
  <p>Only if i change the cache config and add my private <code>QueryCacheFactory</code> with <code>.QueryCacheFactory&lt;CacheFactory&gt;()</code> than it works (But i ignore the <code>IsUpToDate</code> check) </p>
  
  <pre><code>public class CacheFactory : NHibernate.Cache.IQueryCacheFactory
  {
      public NHibernate.Cache.IQueryCache GetQueryCache(string regionName, NHibernate.Cache.UpdateTimestampsCache updateTimestampsCache, Settings settings, IDictionary&lt;string, string&gt; props)
      {
          return new MyStandardQueryCache(settings, props, updateTimestampsCache, regionName);
      }
  
      private class MyStandardQueryCache : NHibernate.Cache.StandardQueryCache
      {
          public MyStandardQueryCache(Settings settings, IDictionary&lt;string, string&gt; props, NHibernate.Cache.UpdateTimestampsCache updateTimestampsCache, string regionName)
              : base(settings, props, updateTimestampsCache, regionName) { }
  
          protected override bool IsUpToDate(Iesi.Collections.Generic.ISet&lt;string&gt; spaces, long timestamp)
          {
              return true; // SET TO TRUE than it's hitting the cache
          }
      }
  }
  </code></pre>