FindAndLoadCache(
DestKey: Integer;
ParamValues: IMetabaseObjectParamValues;
Selections: IDimSelectionSet;
Value: IMatrix): Boolean;
FindAndLoadCache(
DestKey: UInteger;
ParamValues: Prognoz.Platform.Interop.Metabase.IMetabaseObjectParamValues;
Selections: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet;
Value: Prognoz.Platform.Interop.Matrix.IMatrix): Boolean;
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.
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.
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:
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 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(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 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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.ForeSystem;
Public Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
CacheSaver: ICubeCacheSaver;
CrInfo: IMetabaseObjectCreateInfo;
CubIn: ICubeInstance;
Dest: ICubeInstanceDestination;
SelSet: IDimSelectionSet;
i: Integer;
Sel: IDimSelection;
Mat: IMatrix;
Desc: IMetabaseObjectDescriptor;
Descs: ImetabaseObjectDescriptors;
Executor: ICubeInstanceDestinationExecutor;
Iter: IMatrixIterator;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["D_SEP"]
Descs := MObj.Children;
For i := 0 To Descs.count - 1 Do
Desc := Descs.Item[i];
If Desc.ClassId = MetabaseObjectClass.KE_CLASS_CUBE_CACHE_SAVER As integer 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.itdFirst);
While Iter.Valid Do
System.Diagnostics.Debug.WriteLine(Iter.Value);
Iter.Move(IteratorDirection.itdNext);
End While;
CacheSaver.Clear(Dest.Key);
End Sub;
See also: