← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5143: Improved caching of translations

 

------------------------------------------------------------
revno: 5143
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-11-11 14:25:30 +0100
message:
  Improved caching of translations
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java	2011-11-03 12:02:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java	2011-11-11 13:25:30 +0000
@@ -244,7 +244,7 @@
     {
         String hql = "from DataElement d where d.groupSets.size > 0";
 
-        return getQuery( hql ).list();
+        return getQuery( hql ).setCacheable( true ).list();
     }
 
     public void setZeroIsSignificantForDataElements( Collection<Integer> dataElementIds )
@@ -274,6 +274,7 @@
         Criteria criteria = getCriteria();
         criteria.add( Restrictions.eq( "zeroIsSignificant", zeroIsSignificant ) );
         criteria.add( Restrictions.eq( "type", DataElement.VALUE_TYPE_INT ) );
+        criteria.setCacheable( true );
 
         return criteria.list();
     }
@@ -283,7 +284,7 @@
     {
         String hql = "from DataElement d where d.groups.size = 0";
 
-        return getQuery( hql ).list();
+        return getQuery( hql ).setCacheable( true ).list();
     }
 
     @SuppressWarnings( "unchecked" )
@@ -291,7 +292,7 @@
     {
         String hql = "from DataElement d where d.dataSets.size = 0";
 
-        return getQuery( hql ).list();
+        return getQuery( hql ).setCacheable( true ).list();
     }
 
     @SuppressWarnings( "unchecked" )
@@ -299,7 +300,7 @@
     {
         String hql = "from DataElement d where d.dataSets.size > 0";
 
-        return getQuery( hql ).list();
+        return getQuery( hql ).setCacheable( true ).list();
     }
 
     public boolean dataElementExists( int id )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java	2011-11-03 12:18:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java	2011-11-11 13:25:30 +0000
@@ -145,7 +145,7 @@
     {
         final String hql = "from Indicator d where d.groupSets.size > 0";
 
-        return getQuery( hql ).list();
+        return getQuery( hql ).setCacheable( true ).list();
     }
 
     @SuppressWarnings( "unchecked" )
@@ -153,7 +153,7 @@
     {
         final String hql = "from Indicator d where d.groups.size = 0";
 
-        return getQuery( hql ).list();
+        return getQuery( hql ).setCacheable( true ).list();
     }
 
     @SuppressWarnings( "unchecked" )
@@ -161,7 +161,7 @@
     {
         final String hql = "from Indicator d where d.dataSets.size > 0";
 
-        return getQuery( hql ).list();
+        return getQuery( hql ).setCacheable( true ).list();
     }
 
     public int getIndicatorCount()

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2011-10-20 18:51:07 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2011-11-11 13:25:30 +0000
@@ -3,7 +3,7 @@
 
   <diskStore path="java.io.tmpdir" />
 
-  <defaultCache maxElementsInMemory="650000" eternal="false" timeToIdleSeconds="360" timeToLiveSeconds="720"
+  <defaultCache maxElementsInMemory="800000" eternal="false" timeToIdleSeconds="360" timeToLiveSeconds="720"
     overflowToDisk="false" diskPersistent="false" diskExpiryThreadIntervalSeconds="720" memoryStoreEvictionPolicy="LRU" />
 
   <!-- Hibernate entities -->
@@ -66,7 +66,7 @@
 
   <cache name="org.hisp.dhis.options.SystemSetting" maxElementsInMemory="200" />
 
-  <cache name="org.hisp.dhis.translation.Translation" maxElementsInMemory="8000" />
+  <cache name="org.hisp.dhis.translation.Translation" maxElementsInMemory="200000" />
 
   <cache name="org.hisp.dhis.message.MessageConversation" maxElementsInMemory="500" />