You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by "brian.fed7" <br...@gmail.com> on 2011/02/05 17:52:59 UTC

Unable to print Cache Statistics

I am using IBM RAD 7.5.x with IBM WAS 7.x so relying on the OpenJPA provided
by WAS 7.x runtime. I suppose WAS 7.x is OpenJPA 2.x (right?)

I have below configurations:

persistence.xml
----------------
...
<property name="openjpa.DataCache" value="true(EnableStatistics=true)"/>			
<property name="openjpa.DataCache" value="true(CacheSize=50000,
SoftReferenceSize=0)"/>
<property name="openjpa.QueryCache" value="true(CacheSize=1000,
SoftReferenceSize=0)"/>			
<property name="openjpa.QuerySQLCache" value="true"/>
...





Entity Code Snippet
---------------------

...
@Entity
@Table(name="LOOKUP_CODES")
@DataCache(timeout=3600000) // 1hr

public class LookupCodes implements Serializable {
	...
}


As per above configuration I can see the Caching is enabled and working and
I can also see Caching related log generated in my WAS server log files if I
enable OpenJPA logging. 

The problem is I am not unable to print Cache Statistics using below code:

EntityManagerFactory emf =
(EntityManagerFactoryImpl)Persistence.createEntityManagerFactory("MyDomain");
OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(emf);
StoreCache storeCache = oemf.getStoreCache(); 		

boolean contains = storeCache.contains(LookupCodes.class, "7"); // this
statement returns "false" and I wonder why?


then I get below response:

statistics.getReadCount():0
statistics.getHitCount():0
statistics.getWriteCount():0
statistics.getTotalReadCount():0
statistics.getTotalHitCount():0
statistics.getTotalWriteCount():0
statistics.getReadCount(LookupCodes.class)():0
statistics.getHitCount(LookupCodes.class):0
statistics.getWriteCount(LookupCodes.class):0
statistics.getTotalReadCount(LookupCodes.class)():0
statistics.getTotalHitCount(LookupCodes.class):0
statistics.getTotalWriteCount(LookupCodes.class):0


Even though the Caching is working and enabled, why am I not able to print
the Cache statistics? 

Kindly request you to clarify.

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Unable-to-print-Cache-Statistics-tp5995856p5995856.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.