Was there something unclear about my initial post? I'm asking why the key is of type System.Object and what can I expect to be passed in that value? My caching framework using key of type System.String, and the NHContrib project's NHibernate.Caches implementations seem to blindly call .ToString() on the passed in key. Is that the prescribed method for handling the key in this scenario?
On Mar 22, 12:05 pm, Fabio Maulo <[email protected]> wrote: > Key answer > Which is the problem to solve ? > > On Tue, Mar 22, 2011 at 7:54 AM, kellyb <[email protected]>wrote: > > > > > Is there a better place to ask this question? > > > On Mar 18, 1:19 pm, kellyb <[email protected]> wrote: > > > We have our own caching framework that works well and we like it. We'd > > > like to wire it up to NHibernate rather than take a dependency one of > > > the other caching implementations for NH. > > > > I've written an implementation of NHibernate.Cache.ICache that bridges > > > our framework with NH. I based my implementation almost entirely on > > > this: > > > >https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHi... > > > > One thing that jumped out at me right off the bat is the cache keys in > > > the ICache interface are of type object. Our framework key's the cache > > > using strings. I noticed the Velocity implementation above just does > > > a .ToString() on the key instance that's passed to the Get(object key) > > > and Put(object key) methods. That made me a little nervous. > > > > In my testing it appears the "key" object is of type string and it's > > > the entity name. > > > > My questions: > > > > * Is blindly calling .ToString() on the key instance a safe > > > approach (I'm checking for null)? > > > * If this implementation is indeed safe, does that mean it's > > > always a string? > > > * If this is always a string, then why is this of type object? > > > > The NH guys are smarter than me, so the fact it's of type object makes > > > me assume there's something I'm missing here. I really don't want to > > > introduce some obscure, random session management bug with unsafe key > > > usage in my cache implementation. > > > > Any guidance would be appreciated - cheers > > > -- > > 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. > > -- > Fabio Maulo -- 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.
