ICubeInstanceDestination.UpdateCacheBySelection

Syntax

UpdateCacheBySelection(Selection: IDimSelectionSet);

Parameters

Selection. Selection, according to which cache is to be updated.

Description

The UpdateCacheBySelection method updates cache of opened cube instance by the specified selection.

Comments

Unlike UpdateCache, the UpdateCacheBySelection method can update cache simultaneously in several streams. The number of streams is determined automatically and depends on specifications of the computer, on which the update is executed, and the size of the sent selection. The dimension, which selection will be divided for simultaneous processing in streams, should be determined in the ICubeCacheSaver.PartitionDimensionKey property.

NOTE. To ensure method work, one should first set up a connection pool.

If Null is sent as a value of the Selection parameter, the cache is updated by the entire cube selection.

NOTE. Simultaneous cache update is available only in standard cubes.

Example

Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. The cube should have a dimension with the CALENDAR identifier. The cube allows for data caching in the cube cached data warehouse. The CALENDAR dimension is also set in cube settings to be used in simultaneous cache update.

Add links to the Cubes and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MDesc, CacheDesc: IMetabaseObjectDescriptor;
    Cache: ICubeCacheSaver;
    CubeInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    Sel: IDimSelection;
Begin
    MB := MetabaseClass.Active;
    MDesc := MB.ItemById(
"STD_CUBE");
    CacheDesc := GetCache(MDesc);
    
If CacheDesc <> Null Then
        Cache := CacheDesc.Edit 
As ICubeCacheSaver;
        
// Open cube
        CubeInst := MDesc.Open(NullAs ICubeInstance;
        Dest := CubeInst.Destinations.DefaultDestination;
        
// Create selection
        Sels := Dest.CreateDimSelectionSet;
        
For Each Sel In Sels Do
            
If Sel.Dimension.Ident = "CALENDAR" Then
                Sel.SelectAll;
            
Else
                Sel.SelectElement(
0False);
                Sel.SelectElement(
1False);
                Sel.SelectElement(
2False);
            
End If;
        
End For;
        
// Update cache by selection
        Dest.UpdateCacheBySelection(Sels);
    
End If;
End Sub UserProc;

Function GetCache(MObj: IMetabaseObjectDescriptor): IMetabaseObjectDescriptor;
Var
    Desc: IMetabaseObjectDescriptor;
Begin
    
For Each Desc In MObj.Children Do
        
If Desc.ClassId = MetabaseObjectClass.KE_CLASS_CUBE_CACHE_SAVER Then
            
Return Desc;
        
End If;
    
End For;
    
Return Null;
End Function GetCache;

After executing the example the cube cache is updated by the predefined cube selection. The selection of the CALENDAR dimension will be divided into parts for simultaneous cache update.

See also:

ICubeInstanceDestination