Interface CacheControl
-
- All Known Implementing Classes:
CacheControlImpl
public interface CacheControl
API for controlling the contents of the cell cache and the member cache. ACacheControl.CellRegion
denotes a portion of the cell cache, and aCacheControl.MemberSet
denotes a portion of the member cache. Both caches can be flushed, and the member cache can be edited.To create an instance of this interface, use
Connection.getCacheControl(java.io.PrintWriter)
.Methods concerning cell cache:
createMemberRegion(Member, boolean)
createMemberRegion(boolean, Member, boolean, Member, boolean)
createUnionRegion(mondrian.olap.CacheControl.CellRegion[])
createCrossjoinRegion(mondrian.olap.CacheControl.CellRegion[])
createMeasuresRegion(Cube)
flush(mondrian.olap.CacheControl.CellRegion)
Methods concerning member cache:
createMemberSet(Member, boolean)
createMemberSet(boolean, Member, boolean, Member, boolean)
createAddCommand(Member)
createDeleteCommand(Member)
createDeleteCommand(mondrian.olap.CacheControl.MemberSet)
createCompoundCommand(java.util.List)
createCompoundCommand(mondrian.olap.CacheControl.MemberEditCommand[])
createSetPropertyCommand(Member, String, Object)
createSetPropertyCommand(mondrian.olap.CacheControl.MemberSet,java.util.Map)
flush(mondrian.olap.CacheControl.MemberSet)
execute(mondrian.olap.CacheControl.MemberEditCommand)
- Since:
- Sep 27, 2006
- Author:
- jhyde
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
CacheControl.CellRegion
a region of cells in the cell cachestatic interface
CacheControl.MemberEditCommand
An operation to be applied to the member cache.static interface
CacheControl.MemberSet
A specification of a set of members in the member cache.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CacheControl.MemberEditCommand
createAddCommand(Member member)
Creates a command to add a member to the cache.CacheControl.MemberEditCommand
createCompoundCommand(List<CacheControl.MemberEditCommand> cmds)
Builds a compound command which is executed atomically.CacheControl.MemberEditCommand
createCompoundCommand(CacheControl.MemberEditCommand... cmds)
Builds a compound command which is executed atomically.CacheControl.CellRegion
createCrossjoinRegion(CacheControl.CellRegion... regions)
Forms the cartesian product of two or more cell regions.CacheControl.MemberEditCommand
createDeleteCommand(CacheControl.MemberSet memberSet)
Creates a command to delete a set of members from the member cache.CacheControl.MemberEditCommand
createDeleteCommand(Member member)
Creates a command to delete a member and its descendants from the member cache.CacheControl.CellRegion
createMeasuresRegion(Cube cube)
Creates a region consisting of all measures in a given cube.CacheControl.CellRegion
createMemberRegion(boolean lowerInclusive, Member lowerMember, boolean upperInclusive, Member upperMember, boolean descendants)
Creates a cell region consisting of a range between two members.CacheControl.CellRegion
createMemberRegion(Member member, boolean descendants)
Creates a cell region consisting of a single member.CacheControl.MemberSet
createMemberSet(boolean lowerInclusive, Member lowerMember, boolean upperInclusive, Member upperMember, boolean descendants)
Creates a member set consisting of a range between two members.CacheControl.MemberSet
createMemberSet(Member member, boolean descendants)
Creates a member set containing either a single member, or a member and its descendants.CacheControl.MemberEditCommand
createMoveCommand(Member member, Member loc)
Creates a command to Move a member (with its descendants) to a new location, that is to a new parent.CacheControl.MemberEditCommand
createSetPropertyCommand(CacheControl.MemberSet set, Map<String,Object> propertyValues)
Creates a command to several properties changes over a set of members.CacheControl.MemberEditCommand
createSetPropertyCommand(Member member, String name, Object value)
Creates a command to change one property of a member.CacheControl.CellRegion
createUnionRegion(CacheControl.CellRegion... regions)
Forms the union of two or more cell regions.CacheControl.MemberSet
createUnionSet(CacheControl.MemberSet... sets)
Forms the union of two or more member sets.void
execute(CacheControl.MemberEditCommand cmd)
Executes a command that edits the member cache.CacheControl.MemberSet
filter(Level level, CacheControl.MemberSet baseSet)
Filters a member set, keeping all members at a given Level.void
flush(CacheControl.CellRegion region)
Atomically flushes all the cells in the cell cache that correspond to measures in a cube and to a given region.void
flush(CacheControl.MemberSet set)
Atomically flushes all members in the member cache which belong to a given set.void
flushSchema(String catalogUrl, String connectionKey, String jdbcUser, String dataSourceStr)
Flushes the given Schema instance from the pool.void
flushSchema(String catalogUrl, DataSource dataSource)
Flushes the given Schema instance from the pool.void
flushSchema(Schema schema)
Flushes the given Schema instance from the poolvoid
flushSchemaCache()
Flushes the cache which maps schema URLs to metadata.boolean
isTraceEnabled()
Tells if tracing is enabled.void
printCacheState(PrintWriter pw, CacheControl.CellRegion region)
Prints the state of the cell cache as it pertains to a given region.void
printCacheState(PrintWriter pw, CacheControl.MemberSet set)
Prints the state of the member cache as it pertains to a given member set.void
trace(String message)
Prints a debug message.
-
-
-
Method Detail
-
createMemberRegion
CacheControl.CellRegion createMemberRegion(Member member, boolean descendants)
Creates a cell region consisting of a single member.- Parameters:
member
- the memberdescendants
- When true, include descendants of the member in the region.- Returns:
- the new cell region
-
createMemberRegion
CacheControl.CellRegion createMemberRegion(boolean lowerInclusive, Member lowerMember, boolean upperInclusive, Member upperMember, boolean descendants)
Creates a cell region consisting of a range between two members.The members must belong to the same level of the same hierarchy. One of the bounds may be null.
For example, given
thenMember member97Q3; // [Time].[1997].[Q3] Member member98Q2; // [Time].[1998].[Q2]
Expression Meaning createMemberRegion(true, member97Q3, true, member98Q2, false)
The members between 97Q3 and 98Q2, inclusive:
[Time].[1997].[Q3],
[Time].[1997].[Q4],
[Time].[1998].[Q1],
[Time].[1998].[Q2]createMemberRegion(true, member97Q3, false, member98Q2, false)
The members between 97Q3 and 98Q2, exclusive:
[Time].[1997].[Q4],
[Time].[1998].[Q1]createMemberRegion(true, member97Q3, false, member98Q2, false)
The members between 97Q3 and 98Q2, including their descendants, and including the lower bound but not the upper bound:
[Time].[1997].[Q3],
[Time].[1997].[Q3].[7],
[Time].[1997].[Q3].[8],
[Time].[1997].[Q3].[9],
[Time].[1997].[Q4],
[Time].[1997].[Q4].[10],
[Time].[1997].[Q4].[11],
[Time].[1997].[Q4].[12],
[Time].[1998].[Q1],
[Time].[1998].[Q1].[1],
[Time].[1998].[Q1].[2],
[Time].[1998].[Q1].[3]- Parameters:
lowerInclusive
- whether the the range includes the lower bound; ignored if the lower bound is not specifiedlowerMember
- lower bound member. If null, takes all preceding membersupperInclusive
- whether the the range includes the upper bound; ignored if the upper bound is not specifiedupperMember
- upper bound member. If null, takes all preceding membersdescendants
- when true, include descendants of the member in the region- Returns:
- the new cell region
-
createCrossjoinRegion
CacheControl.CellRegion createCrossjoinRegion(CacheControl.CellRegion... regions)
Forms the cartesian product of two or more cell regions.- Parameters:
regions
- the operands- Returns:
- the cartesian product of the operands
-
createUnionRegion
CacheControl.CellRegion createUnionRegion(CacheControl.CellRegion... regions)
Forms the union of two or more cell regions. The regions must have the same dimensionality.- Parameters:
regions
- the operands- Returns:
- the cartesian product of the operands
-
createMeasuresRegion
CacheControl.CellRegion createMeasuresRegion(Cube cube)
Creates a region consisting of all measures in a given cube.- Parameters:
cube
- a cube- Returns:
- the region
-
flush
void flush(CacheControl.CellRegion region)
Atomically flushes all the cells in the cell cache that correspond to measures in a cube and to a given region.- Parameters:
region
- a region
-
printCacheState
void printCacheState(PrintWriter pw, CacheControl.CellRegion region)
Prints the state of the cell cache as it pertains to a given region.- Parameters:
pw
- the output targetregion
- the CellRegion of interest
-
createMemberSet
CacheControl.MemberSet createMemberSet(Member member, boolean descendants)
Creates a member set containing either a single member, or a member and its descendants.- Parameters:
member
- a memberdescendants
- when true, include descendants in the set- Returns:
- the set
-
createMemberSet
CacheControl.MemberSet createMemberSet(boolean lowerInclusive, Member lowerMember, boolean upperInclusive, Member upperMember, boolean descendants)
Creates a member set consisting of a range between two members. The members must belong to the same level of the same hierarchy. One of the bounds may be null. (Similar tocreateMemberRegion(boolean, Member, boolean, Member, boolean)
, which see for examples.)- Parameters:
lowerInclusive
- whether the the range includes the lower bound; ignored if the lower bound is not specifiedlowerMember
- lower bound member. If null, takes all preceding membersupperInclusive
- whether the the range includes the upper bound; ignored if the upper bound is not specifiedupperMember
- upper bound member. If null, takes all preceding membersdescendants
- when true, include descendants of the member in the region- Returns:
- the set
-
createUnionSet
CacheControl.MemberSet createUnionSet(CacheControl.MemberSet... sets)
Forms the union of two or more member sets.- Parameters:
sets
- the operands- Returns:
- the union of the operands
-
filter
CacheControl.MemberSet filter(Level level, CacheControl.MemberSet baseSet)
Filters a member set, keeping all members at a given Level.- Parameters:
level
- LevelbaseSet
- Member set- Returns:
- Member set with members not at the given level removed
-
flush
void flush(CacheControl.MemberSet set)
Atomically flushes all members in the member cache which belong to a given set.- Parameters:
set
- a set of members
-
printCacheState
void printCacheState(PrintWriter pw, CacheControl.MemberSet set)
Prints the state of the member cache as it pertains to a given member set.- Parameters:
pw
- the output targetset
- the MemberSet of interest
-
execute
void execute(CacheControl.MemberEditCommand cmd)
Executes a command that edits the member cache.- Parameters:
cmd
- the command
-
createCompoundCommand
CacheControl.MemberEditCommand createCompoundCommand(List<CacheControl.MemberEditCommand> cmds)
Builds a compound command which is executed atomically.- Parameters:
cmds
- a list of the component commands- Returns:
- the compound command
-
createCompoundCommand
CacheControl.MemberEditCommand createCompoundCommand(CacheControl.MemberEditCommand... cmds)
Builds a compound command which is executed atomically.- Parameters:
cmds
- the component commands- Returns:
- the compound command
-
createDeleteCommand
CacheControl.MemberEditCommand createDeleteCommand(Member member)
Creates a command to delete a member and its descendants from the member cache.- Parameters:
member
- the member- Returns:
- the command
-
createDeleteCommand
CacheControl.MemberEditCommand createDeleteCommand(CacheControl.MemberSet memberSet)
Creates a command to delete a set of members from the member cache.- Parameters:
memberSet
- the set- Returns:
- the command
-
createAddCommand
CacheControl.MemberEditCommand createAddCommand(Member member) throws IllegalArgumentException
Creates a command to add a member to the cache. The added member and its parent must have the same Dimension and the correct Levels, Null parent means add to the top level of its Dimension.The ordinal position of the new member among its siblings is implied by its properties.
- Parameters:
member
- the new member- Returns:
- the command
- Throws:
IllegalArgumentException
- if member null or if member belongs to a parent-child hierarchy
-
createMoveCommand
CacheControl.MemberEditCommand createMoveCommand(Member member, Member loc) throws IllegalArgumentException
Creates a command to Move a member (with its descendants) to a new location, that is to a new parent.- Parameters:
member
- the member movedloc
- the new parent- Returns:
- the command
- Throws:
IllegalArgumentException
- if member is null, or loc is null, or member belongs to a parent-child hierarchy, or if loc is incompatible with member
-
createSetPropertyCommand
CacheControl.MemberEditCommand createSetPropertyCommand(Member member, String name, Object value) throws IllegalArgumentException
Creates a command to change one property of a member.- Parameters:
member
- the membername
- the property namevalue
- the property value- Returns:
- the command
- Throws:
IllegalArgumentException
- if the property is invalid for the member
-
createSetPropertyCommand
CacheControl.MemberEditCommand createSetPropertyCommand(CacheControl.MemberSet set, Map<String,Object> propertyValues) throws IllegalArgumentException
Creates a command to several properties changes over a set of members. All members must belong to the same Level.- Parameters:
set
- the set of memberspropertyValues
- Collection of property-value pairs- Returns:
- the command
- Throws:
IllegalArgumentException
- for an invalid property, or if all members in the set do not belong to the same Level.
-
trace
void trace(String message)
Prints a debug message.- Parameters:
message
- the message
-
isTraceEnabled
boolean isTraceEnabled()
Tells if tracing is enabled.
-
flushSchemaCache
void flushSchemaCache()
Flushes the cache which maps schema URLs to metadata.This cache is referenced only when creating a new connection, so existing connections will continue to use the same schema definition.
Flushing the schema cache will flush all aggregations and segments associated to it as well.
-
flushSchema
void flushSchema(String catalogUrl, String connectionKey, String jdbcUser, String dataSourceStr)
Flushes the given Schema instance from the pool. It resolves the schema to flush by using its catalog URL, connection key and JDBC username.Flushing the schema cache will flush all aggregations and segments associated to it as well.
-
flushSchema
void flushSchema(String catalogUrl, DataSource dataSource)
Flushes the given Schema instance from the pool. It resolves the schema to flush by using its catalog URL and DataSource object.Flushing the schema cache will flush all aggregations and segments associated to it as well.
-
flushSchema
void flushSchema(Schema schema)
Flushes the given Schema instance from the poolFlushing the schema cache will flush all aggregations and segments associated to it as well.
- Parameters:
schema
- Schema
-
-