Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Cache Invalidation not working as expected

  1. #1

    Default Cache Invalidation not working as expected


    Since the database in our application changes very frequently, Mondrian's cache started to become a problem. In order to solve this, I decided to create a simple Java app to invalidate specific regions, whenever there is a change in the database. In the schema there is a dimension called Student (that refers to student IDs) and a dimension called CalendarTime. There is also a measure called Total Present which refers to the students that are Present at school (there are other Attendance measures which are irrelevant to explain my problem).
    In case there is a change in the attendance of student 123 in the present day, I'm invalidating the cache the following way:

    Cube attendanceCube = connection.getSchema().lookupCube("Attendance", true);
    SchemaReader schemaReader = attendanceCube.getSchemaReader(null).withLocus();
    CacheControl.CellRegion totalPresentRegion = cacheControl.createMemberRegion("Total Present", false);
    Member member = schemaReader.getMemberByUniqueName(Id.Segment.toList("Student", "123"), true);
    CacheControl.CellRegion memberRegion = cacheControl.createMemberRegion(member, false);
    Member _date = schemaReader.getMemberByUniqueName(Id.Segment.toList("CalendarTime.No Weeks", "2013", "1", "21"), true);
    CacheControl.CellRegion dateRegion = cacheControl.createMemberRegion(_date, false);
    CacheControl.CellRegion crossjoin = cacheControl.createCrossjoinRegion(memberRegion, dateRegion, measureRegion);

    If I retrieve the Total Present by displaying all the students in the rows, I get the correct result in the row corresponding to student 123 ( select {[Measures].[Total Present]} ON COLUMNS, [Student].[Student].AllMembers ON ROWS from [Attendance] where [CalendarTime].[2013].[1].[21]),
    but if I try to retrieve only the Total Present (select {[Measures].[Total Present]} ON COLUMNS from [Attendance] where [CalendarTime].[2013].[1].[21]), the vale is not correct. This makes me think that I may be missing some cache region to invalidate. Does someone have an hint or solution for this problem?

    Thank you in advance,

  2. #2
    Join Date
    Mar 2007


    When you create the CacheControl object, pass a PrintWriter as the parameter and paste here what you get. This will help debug.
    Luc Boudreau
    aka. Luc le Magnifique
    aka. Monsieur Oui Oui

    Lead Engineer, Pentaho Corporation
    Twitter: luclemagnifique
    IRC: Monsieur_Oui_Oui@freenode

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.