Cache(Key: Integer; ParamValues: IMetabaseObjectParamValues): Variant;
Cache[Key: uinteger; ParamValues: Prognoz.Platform.Interop.Metabase.IMetabaseObjectParamValues]: object;
Key. Key of the caching object.
ParamValues. Values of caching object parameters.
The Cache property returns the internal structure of the object, which represents the cache of the repository object.
If the object is parametric, then it is possible to write to cache the instances with different sets of the parameters.
As the Key parameter for the cubes it is necessary to specify the key of the required variant of cube layout.
Executing the example requires a dictionary with the Dimension identifier and enabled possibility of data caching.
Add links to the Io, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CacheKeeper: IMetabaseObjectInstanceCacheKeeper;
CacheM: Variant;
MObj: IMetabaseObject;
VarStream: Variant;
Stream: IIOStream;
F: IFileStream;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("Dimension").Edit As IMetabaseObject;
CacheKeeper := MObj.Children.Item(0).Bind As IMetabaseObjectInstanceCacheKeeper;
CacheM := CacheKeeper.Cache(MObj.Key, Null);
VarStream := CacheM;
CacheM := Null;
Stream := IOStream.FromVariant(VarStream);
F := New FileStream.Create("C:\Temp\1.dat", FileOpenMode.Write, FileShare.DenyWrite);
F.CopyFrom(Stream, Stream.Size);
End Sub UserProc;
Imports Prognoz.Platform.Interop.ForeIO;
Public Sub Main(Params: StartParams);
Var
MB: IMetabase;
CacheKeeper: IMetabaseObjectInstanceCacheKeeper;
MObj: IMetabaseObject;
CacheM: Object;
VarStream: Object;
FS: FileStreamClass = New FileStreamClass();
IOSt: IOStreamClass = New IOStreamClass();
Stream: Prognoz.Platform.Interop.ForeIO.IIOStream;
Begin
Metabase := Params.Metabase;
MObj := MB.ItemById["Dimension"].Edit() As IMetabaseObject;
CacheKeeper := MObj.Children.Item[0].Bind() As IMetabaseObjectInstanceCacheKeeper;
CacheM := CacheKeeper.Cache[MObj.Key, Null];
VarStream := CacheM;
CacheM := Null;
Stream := IOSt.FromVariant(VarStream);
FS.Create("C:\Temp\1.dat", FileOpenMode.frCreate, FileShare.frDenyWrite);
FS.CopyFrom(Stream, Stream.Size);
End Sub;
After executing the example the internal structure of the object, which represents the cache of the repository object, will be obtained to the data stream. This structure will be saved to the file.
See also: