FindAndLoadCache(
DestKey: Integer;
ParamValues: IMetabaseObjectParamValues;
Selections: IDimSelectionSet;
Value: IMatrix): Boolean;
DestKey. The key of the required cube display version.
ParamValues. Parameter values of the specified caching object.
Selections. The collection of selections in the specified cube display version.
Value. Matrix of cube values.
The FindAndLoadCache method finds and loads cube cache for the specified cube display version with the specified parameter values to the specified matrix and returns whether the corresponding cache is in the database.
If the cube is not parametric, send Null as the value of the ParamValues parameter. The method puts the found cached cube data to the matrix specified in the Value parameter.
The method results in the successful search:
True. Data is found.
False. Data is not found.
Executing the example requires a cube with the D_SEP identifier. Data caching must be enabled for the cube in the cube cached data warehouse.
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(Null) As ICubeInstance;
Dest := CubIn.Destinations.DefaultDestination;
SelSet := Dest.CreateDimSelectionSet;
For i := 0 To SelSet.Count - 1 Do
Sel := SelSet.Item(i);
Sel.SelectElement(0, False);
Sel.SelectElement(1, False);
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, search is executed among the child objects of the specified cube for the cached data warehouse. Cube cached data is loaded from the first found storage by the specified parameters and are displayed in the console. After loading the cache will be cleared by the specified key of the cube display version.
See also: