Mondrian Cube Cache 清除

来源:互联网 发布:淘宝第二层级什么意思 编辑:程序博客网 时间:2024/05/21 09:45

在Pentaho论坛上查到,发现一段代码可以清除Cube的cache,试验成功,代码如附件flush.jsp。
在报表展示页面加一个imagebutton,设置href=“flush.jsp”,点击按钮后可以清除cache。

 

附 flush.jsp:
<%@ page session="true" contentType="text/html; charset=ISO-8859-1" %>
<%@ taglib uri="http://www.tonbeller.com/jpivot" prefix="jp" %>
<%@ taglib uri="http://www.tonbeller.com/wcf" prefix="wcf" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<%
java.util.Iterator<mondrian.rolap.RolapSchema> schemaIterator =  mondrian.rolap.RolapSchema.getRolapSchemas();
while(schemaIterator.hasNext()){
    mondrian.rolap.RolapSchema schema = schemaIterator.next();
    mondrian.olap.CacheControl cacheControl = schema.getInternalConnection().getCacheControl(null);
   
    for (mondrian.olap.Cube cube : schema.getCubes()) {
        cacheControl.flush(cacheControl.createMeasuresRegion(cube));
    }
}

String redirectURL = request.getHeader("Referer");
response.sendRedirect(redirectURL);       
%>

 

原创粉丝点击