-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Getting cache statistics from EHCache
PostPosted: Tue May 11, 2004 11:37 am 
Newbie

Joined: Tue May 11, 2004 11:32 am
Posts: 16
I'm using the EHCache for a read-only caches on my classes. The EHCache object contains some simple statistics (hitCount, missCountExpired, missCountNotFound) that I would like to use to tune my cache settings.

How do I access the net.sf.ehcache.Cache object? It looks like I need to change hibernate code to do this (specifically, by adding "getCache()" to the various cache objects (like ReadOnlyCache)).

Is there a better way for me to access the cache statistics?

thanks
Sam


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 11:41 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You can probably create your own CacheProvider to keep a reference to the cache.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 2:39 pm 
Newbie

Joined: Tue May 11, 2004 11:32 am
Posts: 16
I've tried that, but unfortunately, the Cache that net.sf.ehcache.hibernate.Provider returns from buildCache is actually an instance of net.sf.ehcache.hibernate.Plugin which stores the Cache in a private member variable. This effectively hides all of the cache statistics from me.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 3:42 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Good point, we probably should offer a cache hook in Hibernate3 for monitoring. I think you can just modify the EHCache source for a quick solution.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 3:49 pm 
Newbie

Joined: Tue May 11, 2004 11:32 am
Posts: 16
I ended up using my own CacheProvider that passes through to the EHCache Provider but remembers each cache that is created (it would be nice if there was an API for retrieving the cache from the ClassPersistor perhaps). I then use reflection to get the private "cache" field from the Plugin object.

Thanks for your help.
sam


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.