GetGlobalCache(
DestKey: Integer;
ParamValues: IMetabaseObjectParamValues;
Selections: IDimSelectionSet): IMatrix;
GetGlobalCache(
DestKey: UInteger;
ParamValues: Prognoz.Platform.Interop.Metabase.IMetabaseObjectParamValues;
Selections: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet): Prognoz.Platform.Interop.Matrix.IMatrix;
DestKey. The key of the required cube display version.
ParamValues. The set of parameter values, for which caching object is saved.
Selections. The collection of selections in the specified cube display version.
The GetGlobalCache method returns the cube data matrix obtained from cache according to passed cube cache parameters.
The method works in the same way as the FindAndLoadCache method but does not return whether search is successful. If cache contains data according to specified parameters, the GetGlobalCache method returns them as a matrix. If there are no data, the method returns Null.
Executing the example requires that the repository contains a cube with the D_SEP identifier. Data caching is available for the cube.
Sub UserProc;
Var
MB: IMetabase;
MDesc, CacheDesc: IMetabaseObjectDescriptor;
Cache: ICubeCacheSaver;
CubeInst: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Sel: IDimSelection;
Matr: IMatrix;
Begin
MB := MetabaseClass.Active;
MDesc := MB.ItemById("D_SEP");
CacheDesc := GetCache(MDesc);
If CacheDesc <> Null Then
Cache := CacheDesc.Edit As ICubeCacheSaver;
CubeInst := MDesc.Open(Null) As ICubeInstance;
Dest := CubeInst.Destinations.DefaultDestination;
Sels := Dest.CreateDimSelectionSet;
For Each Sel In Sels Do
Sel.SelectAll;
End For;
//Get cached matrix with data
Matr := Cache.GetGlobalCache(Dest.Key, Null, Sels);
If Matr <> Null Then
//Further working with data matrix
End If;
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;
On executing the example the matrix of cached data will be obtained for the specified cube parameters.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MDesc, CacheDesc: IMetabaseObjectDescriptor;
Cache: ICubeCacheSaver;
CubeInst: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Sel: IDimSelection;
Matr: IMatrix;
Begin
MB := Params.Metabase;
MDesc := MB.ItemById["D_SEP"];
CacheDesc := GetCache(MDesc);
If CacheDesc <> Null Then
Cache := CacheDesc.Edit() As ICubeCacheSaver;
CubeInst := MDesc.Open(Null) As ICubeInstance;
Dest := CubeInst.Destinations.DefaultDestination;
Sels := Dest.CreateDimSelectionSet();
For Each Sel In Sels Do
Sel.SelectAll();
//Sel.SelectElement(0, False);
End For;
//Get cached matrix with data
Matr := Cache.GetGlobalCache(Dest.Key, Null, Sels);
If Matr <> Null Then
//Further working with data matrix
End If;
End If;
End Sub;
Public Shared 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 As integer Then
Return Desc;
End If;
End For;
Return Null;
End Function;
See also: