mondrian维度缓存没有被刷新

时间:2013-07-31 18:17:20

标签: caching mondrian saiku

我正在尝试通过以下代码刷新mondrian维度缓存 -

     org.olap4j.metadata.Schema OlapSchema = olapConnection.getOlapSchema();
     NamedList<org.olap4j.metadata.Cube> cubeList =  OlapSchema.getCubes();
     org.olap4j.metadata.Member m = null;
     for(org.olap4j.metadata.Cube cube: cubeList) {
    m = cube.lookupMember(IdentifierNode.parseIdentifier( "[Time].[2013].[Jul2013]").getSegmentList());
       final CacheControl cacheControl = olapConnection.getCacheControl(null);
       CacheControl.MemberSet regionTime = cacheControl.createMemberSet(mondrian.olap.Member)m, false);
       cacheControl.flush(regionTime);

     }

但是这段代码抛出了一个运行时错误“MondrianOlap4jMember和mondrian.olap.member是不兼容的”

1 个答案:

答案 0 :(得分:0)

看起来您需要执行以下操作来刷新缓存 - 使用Olap wrapper class解包lookupMember函数返回的成员对象,如此 -

m = cube.lookupMember(IdentifierNode.parseIdentifier(“[Time]。[2013]。[Jul2013]”)。getSegmentList()); OlapWrapper wrapper =(OlapWrapper)m; mondrian.olap.Member MondrianMember = wrapper.unwrap(mondrian.olap.Member.class);

现在调用flush方法 -

cacheControl.flush(MondrianMember);