Cannot find handle for Mondrian CacheControl

I use Mondrian as my server server.

I have a scenario in which some of my measurement data changes. When this happens, I want to clear the mondrian cache.

I cannot figure out how I can get the Mondrian cache management descriptor.

I have a reference to an OlapConnection object, but I could not find any method that would give a CacheControl handle

Any suggestions?

Yoshi

+4
source share
2 answers

The answer given by bhuang3 is right. To access cache management from an olap4j connection:

 OlapConnection.unwrap(mondrian.rolap.RolapConnection.class).getCacheControl(null) 
+3
source

Well, you can use the following APIs to clear the cube cache

 mondrian.olap.CacheControl cacheControl = connection.getCacheControl(null); mondrian.olap.Schema schema = connection.getSchema(); mondrian.olap.Cube cube = schema.lookupCube(cubeName, false); mondrian.olap.CacheControl.CellRegion cellRegion = cacheControl.createMeasuresRegion(cube); cacheControl.flush(cellRegion); 

Or you can clear the schema cache

 cacheControl.flushSchemaCache(); 

Alternatively, please read this document for more details.

+1
source

All Articles