GetItemsFromDatabase(
[Destkey: Integer = -1;]
[ParamValues: IMetabaseObjectParamValues: = Null]): ICubeCacheItems;
Destkey. The key of cube display version.
ParamValues. Parameter values set.
The GetItemsFromDatabase method, according to the specified parameters, gets cache instances from caxche storage in DBMS.
If there is no cached data for the specified cube display version parameter values set, the method will return the empty collection of cache instances.
Executing the example requires a standard cube with the STD_CUBE identifier. A data set is cache for the cube.
Add links to the Cubes and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MDesc, CacheDesc: IMetabaseObjectDescriptor;
CacheSaver: ICubeCacheSaver;
Items: ICubeCacheItems;
Begin
MB := MetabaseClass.Active;
MDesc := MB.ItemById("STD_CUBE");
// Get cache storage
CacheDesc := GetCache(MDesc);
If CacheDesc <> Null Then
CacheSaver := CacheDesc.Bind As ICubeCacheSaver;
// Cache instances from DBMS
Items := CacheSaver.GetItemsFromDatabase;
ShowCacheItems(Items);
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;
Sub ShowCacheItems(Items: ICubeCacheItems);
Var
Item: ICubeCacheItem;
DimSS: IDimSelectionSet;
DimS: IDimSelection;
i, c: Integer;
Begin
Debug.WriteLine("Number of cache instances: " + Items.Count.ToString);
c := Items.Count;
For i := 0 To c - 1 Do
Item := Items.Item(i);
Debug.WriteLine("Cache instance hash code: " + Item.Hash + ". Last modified: " + Item.Date.ToString);
Debug.Write("Display version (key): " + Item.DestinationKey.ToString + ". " +
"Custom label: " + Item.CustomValue);
If IsNull(Item.ParamValues) = False Then
Debug.WriteLine(". Parameters: " + Item.ParamValues.Count.ToString + '.');
Else
Debug.WriteLine(". No parameters.");
End If;
End For;
DimSS := Item.SelectionSet;
Debug.WriteLine("Selection, by which cache instance was saved.");
Debug.WriteLine("Dimensions:");
Debug.Indent;
For Each DimS In DimSS Do
Debug.WriteLine(DimS.Dimension.Name + ". Selected: " + DimS.SelectedCount.ToString);
End For;
Debug.Unindent;
End Sub ShowCacheItems;
After executing the example, cache instance will be obtained for the specified cube. Information about instances will be displayed in the development environment console.
See also: