IMetabaseCache.FlushAll

Syntax

FlushAll;

Description

The FlushAll method flushes links of objects stored in repository cache.

Comments

On executing the method local assemblies cache is also flushed, in which compiled versions of repository modules/forms/assemblies are stored. It causes further recompilation of started objects. If the number of objects to be recompiled is too large, it may strongly slow down startup time.

To flush cache without flushing assemblies cache, use the IMetabaseCache.MetabaseFlushAll or IMetabaseCache.MetabaseFlush methods.

Example

Executing the example requires that the repository contains an object with the Object_1 identifier.

Sub UserProc;
Var
    MB: IMetaBase;
    Obj1, Obj2, Obj3: IMetaBaseObject;
    Cache: IMetabaseCache;
Begin
    MB := MetabaseClass.Active;
    Cache := MB.Cache;
    Obj1 := MB.ItemById(
"Object_1").Bind;
    Obj2 := MB.ItemById(
"Object_1").Bind;
    Cache.FlushAll;
    Obj3 := MB.ItemById(
"Object_1").Bind;
    
If Obj1 = Obj2 Then
        Debug.WriteLine(
"Obj1 = Obj2");
    
Else
        Debug.WriteLine(
"Obj1 <> Obj2");
    
End If;
    
If Obj1 = Obj3 Then
        Debug.WriteLine(
"Obj1 = Obj3");
    
Else
        Debug.WriteLine(
"Obj1 <> Obj3");
    
End If;
End Sub UserProc;

On executing the example a copy of the object with the Object_1 identifier is put in repository cache. The obj1 and obj2 variables contain a link to this copy. After the FlushAll method call a link to this object is flushed and while the next call another copy of the object is put in cache. The obj3 variable contains a link to the second copy of the object with the Object_1 identifier. The result of comparing variables is displayed in the development environment console.

See also:

IMetabaseCache