← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15492: Web API, MaintenanceController, added function for clearing application cache

 

------------------------------------------------------------
revno: 15492
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-06-01 13:32:19 +0200
message:
  Web API, MaintenanceController, added function for clearing application cache
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java


--
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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java	2014-06-01 11:32:19 +0000
@@ -28,6 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.analytics.partition.PartitionManager;
+import org.hisp.dhis.cache.HibernateCacheManager;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.maintenance.MaintenanceService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +53,12 @@
     @Autowired
     private DataElementCategoryService categoryService;
 
+    @Autowired
+    private HibernateCacheManager cacheManager;
+
+    @Autowired
+    private PartitionManager partitionManager;    
+    
     @RequestMapping( value = "/periodPruning", method = { RequestMethod.PUT, RequestMethod.POST } )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" )
     public void prunePeriods()
@@ -71,4 +79,12 @@
     {
         categoryService.updateAllOptionCombos();
     }
+
+    @RequestMapping( value = "/clearCache", method = { RequestMethod.PUT, RequestMethod.POST } )
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" )
+    public void clearCache()
+    {
+        cacheManager.clearCache();
+        partitionManager.clearCaches();
+    }    
 }