Thank you, one and all, for the good insight. I'm new to NHibernate and I might have dumb questions or perhaps be too wordy. You can say whatever you want about me, I also have a thick skin, like Fabio said, you will have a very hard time to offend me :)
So, please if you could just clarify a little more, that would be great. What did you mean by: "the underlying caching system used for l2 caching is the one you can add the object to yourself, that's what was meant." Great so it does sound like there's a way to add an object received via network connection into the L2 cache, by accessing "the underlying system". But in some ways that last statement contradicted your previous few which said that was the ORM's job. If you could just provide a link or two that might demonstrate how to do add an object to that myself, I think that would solve my original need. Thanks again, H On Aug 5, 1:21 am, "Frans Bouma" <[email protected]> wrote: > Apparently no-one else is mature enough to answer this guy's questions, so > let me give it a try. > > > "The NH cache is for objects retrieved by NH" > > > I understand that. What confuses me is that somebody wrote an API to take > > things out of that cache without writing an API to put things into it. > > > Why allow the ability to take something out of that cache? Somebody had > > justification for writing such a function back in the day. > > The caching mechanism is in the o/r mapper, it's FOR the o/r mapper, > when it materializes entity class instances with the data from the db. So > objects end up in the cache because the o/r mapper decided to do so. > > It can be you need to remove an object from the cache, because you > removed it from the db using other means, e.g. a trigger, a separate process > on another machine, you name it. This way you can, in case of emergency, > remove it. I think that's the reason behind this method but we can only > guess, we didn't write the method. I agree that it's not a shiny example of > proper design, but NHibernate has plenty of that kind of hodgepodge stuff, > added during the years, as it's a framework which exists for a long time > (and inherited it from the Java version) > > > > > So, isn't that same justification viable for a reason to be able to stuff > > something into that cache? Even better yet a > > SessionFactory.Replace(object) would be perfect, because I just need to > take > > the new copy of Object A and overwrite the old Object A and have that new > > Object A be the master. > > that would mean you'd place yourself on the seat of the o/r mapper > which decides when to keep objects in the cache. That's not your job, leave > that to the o/r mapper. If you want to use a cache for your objects, use ... > a cache :) The l2 cache here is out of reach so use another one. > > > > > "If you are getting it from other source, you can cache it yourself using > > the same underlying cache (syscache, memcached, etc)" > > > I'm not sure what you mean. Are you saying there is a way to stuff an > > object into the L2 cache? If so, how do I get at the SessionFactory's > > underlying memory structure that is used to implement that cache? Or, are > > you saying that I should implement my own cache, separate from > > SessionFactory? In that case, what good would it do, because > SessionFactory > > wouldn't be aware that I have a separate cache where it could find objects > > instead of selecting them. > > the underlying caching system used for l2 caching is the one you can > add the object to yourself, that's what was meant. > > FB > > > > > > > Thanks for your help. > > Hugh > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
