Every second I store many Foo objects, but the new object is compared to the previous one.
Can I configure NHibernate's second level cache to save only the last Foo object, or should I implement this myself?
Small context:
I have a Doo object that is cached and has a LastFoo link for the Foo object. Doo is cached, but Foo is not. Maybe this cache can only be done using the link to the latest Foo?
Additional information:
When a new Foo is created, it is obvious that it will be stored in the database. I refer to it through the LastFoo property. When the next Foo is created, I have to compare with the previous and only with one. I can take it from LastFoo, but NHibernate always requests it.
How to avoid db hit for previous Foo (and just that, I don't want to cache all Foo objects)? Is this possible with NHibernate or do I need to cache it myself?
source share