getBufferStatistics

getBufferStatistics(obj: Object;
                    jdo: JadeDynamicObject): Boolean;

The getBufferStatistics method of the Process class returns cache-related information about the object specified by the obj parameter. The cache information is returned as attributes inserted into the JadeDynamicObject instance specified by the jdo parameter.

The calling process is responsible for creating and deleting this instance. Any existing attributes in the JadeDynamicObject instance are cleared when the getBufferStatistics method is called.

The method returns true if the object was in cache at the time of the call, and false if the object was not in cache. It does not load an object into cache if it was not already present.

For details about the attributes inserted into the JadeDynamicObject instance, see "Process::getBufferStatistics Method", in Chapter 4 of the JADE Object Manager Guide.

The getBufferStatistics method can be used with persistent and transient objects. With transient objects, a process can examine only shared transient objects and its own non-shared transient objects.

A process can use only its own Process instance as the method receiver. Using any other Process instance causes a 1265 exception (Environmental object operation is out of scope for process) to be raised.

The following example shows the use of the getBufferStatistics method.

showAnimalsInCache();
vars
    root : Root;
    animal : Animal;
    jdo : JadeDynamicObject;
begin
    create jdo transient;
    root := Root.firstInstance;
    foreach animal in root.allAnimals do
        if process.getBufferStatistics(animal, jdo) then
            write animal.String & " is loaded in cache";
            write "  Size (bytes)   = " &
                       jdo.getAttributeValue("size").Integer.String;
            write "  Lives          = " &
                       jdo.getAttributeValue("lives").Integer.String;
            write "  Cycles         = " &
                       jdo.getAttributeValue("cycles").Integer.String;
            write "  Flag           = " &
                       jdo.getAttributeValue("flag").Integer.String;
            write "  Operations     = " &
                       jdo.getAttributeValue("operations").Integer64.String;
            write "  Age(node ticks) =" &
                       jdo.getAttributeValue("age").Integer64.String;
        endif;
    endforeach;
epilog
    delete jdo;
end;

The output from the getBufferStatistics method shown in the previous example is as follows.

Animal/2096.11345 is loaded in cache
  Size (bytes)   = 191
  Lives          = 1
  Cycles         = 15
  Flag           = 1
  Operations     = 2
  Age(node ticks)= 17525
Animal/2096.456 is loaded in cache
  Size (bytes)   = 191
  Lives          = 1
  Cycles         = 10
  Flag           = 1
  Operations     = 2
  Age(node ticks)= 32016
Animal/2096.987 is loaded in cache
  Size (bytes)   = 191
  Lives          = 1
  Cycles         = 10
  Flag           = 1
  Operations     = 2
  Age(node ticks)= 67374
Animal/2096.1000 is loaded in cache
  Size (bytes)   = 191
  Lives          = 1
  Cycles         = 10
  Flag           = 1
  Operations     = 2
  Age(node ticks)= 68384