MicroStrategy ONE

Invalidating the Caches of a Project

The sample code below illustrates how to invalidate all the report cache which belongs to a particular project.

 // create a WebObjectsFactory instance

 WebObjectsFactory factory = WebObjectsFactory.getInstance();

 

 // Get the cache source object

 CacheSource source = (CacheSource) factory.getMonitorSource(EnumWebMonitorType.WebMonitorTypeCache);

 

 // Obtain the cache manipulator object

 CacheManipulator cacheManipulator = source.getManipulator();

 String projectDSSID = "[project DSSID]";

 

 // Create a monitor filter object to add a condition that we will delete caches of the project

 // of the specified project DSSID

 MonitorFilter filter = cacheManipulator.newMonitorFilter();

 filter.add(EnumDSSXMLCacheInfo.DssXmlCacheInfoProjectGuid, EnumDSSXMLMonitorFilterOperator.DssXmlEqual, projectDSSID);

 

 // Add a batch operation to invalidate caches of the specified project

 cacheManipulator.addManipualtionTask(projectDSSID, EnumDSSXMLCacheAdminAction.DssXmlInvalidateCache, filter);

 

 try {

      // Sends the request to Intelligence Server to retrieve cache information

      cacheManipulator.submit();     

 } catch (WebObjectsAdminException woae) {

          woae.printStackTrace();

 } catch (MonitorManipulationException mme) {

          // We have cache manipulation failure, so we display the error

          MonitorManipulationFailure[] mmf = mme.getFailures();

          displayFailure(mmf);

 }