query cache

7 views
Skip to first unread message

Aaron Boxer

unread,
Dec 10, 2010, 4:41:56 PM12/10/10
to nhibernate-...@googlegroups.com
Hello,

I am looking into the caching code, and I can't see any locking
to prevent multiple sessions from concurrently accessing the query cache.

The L2 entity cache does have locking through the cache concurrency
strategy, but not the query cache.

Any insight would be greatly appreciated,

Aaron

Fabio Maulo

unread,
Dec 10, 2010, 5:45:15 PM12/10/10
to nhibernate-...@googlegroups.com
exactly to lock what, in the query cache ?
Ids ?
values of projections ?
--
Fabio Maulo

Aaron Boxer

unread,
Dec 10, 2010, 8:51:36 PM12/10/10
to nhibernate-...@googlegroups.com
I mean a hard lock. The underlying cache may not be thread safe, so I
was expecting there to be
some form of Monitor surrounding any Put or Get on the cache.

Something like:

lock (QueryCache)
{
SessionFactoryImpl.getQueryCache(Region).Put(...)

}

lock (QueryCache)
{
SessionFactoryImpl.getQueryCache(Region).Get(..)

}


The read write concurrency strategy has two hard locks, on global
lock, and one per key lock.


Thanks,
Aaron

Fabio Maulo

unread,
Dec 11, 2010, 5:56:56 AM12/11/10
to nhibernate-...@googlegroups.com
"The underlying cache may not be thread safe" ?
a cache system no thread safe ?
--
Fabio Maulo

Aaron Boxer

unread,
Dec 11, 2010, 8:56:06 AM12/11/10
to nhibernate-...@googlegroups.com
ahhh, I was looking at the HashtableCache, which is not thread safe,
but I guess all
production grade caches are. And, the cache concurrency strategy
needs a hard lock because it does multiple operations on the cache and needs
to be assured that no other thread has modified the cache. Makes sense.
Thanks.
Aaron
Reply all
Reply to author
Forward
0 new messages