﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>James,
  
Yes
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment21</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment21</guid><pubDate>Thu, 11 Jun 2009 13:23:15 GMT</pubDate></item><item><title>James Spibey commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Is there a way to tell NHibernate to cache an entire table the first time any entity is loaded from it? I often use a series of small lookup tables which my entities reference and it would make sense to load the entire lookup table rather than query the DB for each value
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment20</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment20</guid><pubDate>Thu, 11 Jun 2009 12:54:16 GMT</pubDate></item><item><title>RichB commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Ooops. Sorry. I'm still learning.
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment19</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment19</guid><pubDate>Fri, 05 Jun 2009 14:00:30 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>RichB,
  
What I am talking about here is the _2nd_ level cache
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment18</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment18</guid><pubDate>Fri, 05 Jun 2009 13:08:32 GMT</pubDate></item><item><title>Gunnar Liljas commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>The session cache is not the same thing as this (2nd level cache)
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment17</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment17</guid><pubDate>Fri, 05 Jun 2009 12:48:36 GMT</pubDate></item><item><title>RichB commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>NHibernate in Action (pg156) says:
  
  
&gt; You don't have to do anything special to enable the session cache. It's always on and, for the reasons shown, can't be turned off.
  
  
WTF?
  
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment16</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment16</guid><pubDate>Fri, 05 Jun 2009 12:26:35 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Michael,
  
Either don't use caching, or cache Post.
  
See my reply to Cassio for the reasoning behind that decision
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment15</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment15</guid><pubDate>Fri, 05 Jun 2009 11:54:46 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Cassio,
  
That depends on your scenario, I can't really tell.
  
Enabling cache on Post would be easiest, but is it cachable? For how long? If it drops out of the cache, you are back to the same problem.
  
That is why this is sensitive to context.
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment14</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment14</guid><pubDate>Fri, 05 Jun 2009 11:53:02 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>iocer,
  
You need to cache the entities as well
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment13</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment13</guid><pubDate>Fri, 05 Jun 2009 11:51:32 GMT</pubDate></item><item><title>Gunnar Liljas commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>In theory I guess it would be possible for NHibernate to make an informed decision whether to load from cache or not. 
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment12</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment12</guid><pubDate>Fri, 05 Jun 2009 08:26:06 GMT</pubDate></item><item><title>iocer commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>So how do we cache data instead of ids with NH ?
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment11</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment11</guid><pubDate>Fri, 05 Jun 2009 08:23:18 GMT</pubDate></item><item><title>Cassio Tavares commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>But you didn't put the 
&lt;cache in Post mapping. Now the question is. To solve this problem is better enable cache in Post or turn off the cache?
  
  
Shame on me. Working with NHibernate for at least 3 years I should know the answer but of course that a simple test can show it to us.
  
But without any test,  I think that enabling cache on Post will solve the Select N+1 problem.
&gt;</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment10</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment10</guid><pubDate>Thu, 04 Jun 2009 22:52:17 GMT</pubDate></item><item><title>Michael Teper commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>So in the example you outlined, what would be the solution?
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment9</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment9</guid><pubDate>Thu, 04 Jun 2009 19:30:18 GMT</pubDate></item><item><title>Miki Watts commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Ah, excellent, thanks.
  
Though, what if I don't know the IDs of what I want and i need to query for them? Would I call FindByPrimaryKey on each one of them afterwards so it'll store the id ?
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment8</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment8</guid><pubDate>Thu, 04 Jun 2009 17:37:50 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Miki,
  
FindByPrimaryKey translate to that, and calling it with true or false will render the appropriate get/load call.
  
And you just load the collection
  
  
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment7</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment7</guid><pubDate>Thu, 04 Jun 2009 10:51:57 GMT</pubDate></item><item><title>Miki Watts commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Thanks, Ayende, I finally understood how Get/Load works and its effects on the second level cache. 
  
But if I'm using ActiveRecord, and I don't usually have access to the Session, how do I load entities with ActiveRecord so that they'll go into the second level cache ?
  
  
Also, how do I put a collection of entities into the second cache all at once, without having select n+1 ?
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment6</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment6</guid><pubDate>Thu, 04 Jun 2009 06:18:21 GMT</pubDate></item><item><title>CaliCoder commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Sign me up
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment5</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment5</guid><pubDate>Thu, 04 Jun 2009 03:56:22 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Dmitry,
  
You would be surprised how much a 5 min cache can help to app perf.
  
And yes, there is such a thing, SysCache2 can understand SqlDependencies.
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment4</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment4</guid><pubDate>Thu, 04 Jun 2009 01:54:48 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>Cali,
  
NH Prof _IS_ Hibernate Compatible.
  
Would you like to take part in the private beta?
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment3</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment3</guid><pubDate>Thu, 04 Jun 2009 01:53:59 GMT</pubDate></item><item><title>Dmitry commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>The only time I'm using second level cache for entities _and_ collections that rarely/never change like customer types or countries. Caching queries or collections of entities that change frequently is likely to cause more issues than it solves.
  
  
Is there a cache in NHibernate that works with MS SQL notifications?
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment2</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment2</guid><pubDate>Thu, 04 Jun 2009 00:47:12 GMT</pubDate></item><item><title>CaliCoder commented on NHibernate – Beware of inadvisably applied caching strategies</title><description>I haven't tried your app yet since it's not Hibernate compatible, but if it analyzes these types of situations and warns us mere mortals of the traps then "NH Profiler is your friend" is what the people will say
</description><link>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment1</link><guid>http://ayende.com/4046/nhibernate-beware-of-inadvisably-applied-caching-strategies#comment1</guid><pubDate>Thu, 04 Jun 2009 00:16:11 GMT</pubDate></item></channel></rss>