ICubeCacheSaver.FindAndLoadCache

Syntax

FindAndLoadCache(

DestKey: Integer;

ParamValues: IMetabaseObjectParamValues;

Selections: IDimSelectionSet;

Value: IMatrix): Boolean;

Parameters

DestKey. The key of the required cube display version.

ParamValues. The values of parameters of the specified caching object.

Selections. The collection of selections in the specified cube display version.

Value. Matrix of cube values.

Description

The FindAndLoadCache method finds and loads cache of the cube for the specified cube display version with the specified values of the parameters into the specified matrix and returns whether the corresponding cache is in the database.

Comments

If the cube is not parametric one, pass Null as the value of the ParamValues parameter. The method puts the found cached data of the cube to the matrix that is specified in the Value parameter.

The method results in the successful search:

Example

Executing the example requires a cube with the D_SEP identifier. Data caching must be enabled in the storage of the cached data of the cube.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    CacheSaver: ICubeCacheSaver;
    CrInfo: IMetabaseObjectCreateInfo;
    CubIn: ICubeInstance;
    Dest: ICubeInstanceDestination;
    SelSet: IDimSelectionSet;
    i: Integer;
    Sel: IDimSelection;
    Desc: IMetabaseObjectDescriptor;
    Executor: ICubeInstanceDestinationExecutor;
    Iter: IMatrixIterator;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("D_SEP");
    For Each Desc In MObj.Children Do
        If Desc.ClassId = MetabaseObjectClass.KE_CLASS_CUBE_CACHE_SAVER Then
            CacheSaver := Desc.Edit As ICubeCacheSaver;
        End If;
    End For;
    CubIn := MObj.Open(NullAs ICubeInstance;
    Dest := CubIn.Destinations.DefaultDestination;
    SelSet := Dest.CreateDimSelectionSet;
    For i := 0 To SelSet.Count - 1 Do
        Sel := SelSet.Item(i);
        Sel.SelectElement(0False);
        Sel.SelectElement(1False);
    End For;
    Executor := Dest.CreateExecutor;
    Executor.PrepareExecute(SelSet);
    CacheSaver.FindAndLoadCache(Dest.Key, Null, SelSet, Executor.Matrix);
    Iter := Executor.Matrix.CreateIterator;
    Iter.Move(IteratorDirection.First);
    While Iter.Valid Do
        Debug.WriteLine(Iter.Value);
        Iter.Move(IteratorDirection.Next);
    End While;
    CacheSaver.Clear(Dest.Key);
End Sub UserProc;

After executing the example the search among the child objects of the specified cube for the storage of cached data. From the first found storage the cached data of the cube by the specified parameters will be loaded and displayed in the console. After loading the cache will be found by the specified key of the cube display version.

See also:

ICubeCacheSaver