Refresh Method (PISDK Object)

                    

 

The Refresh method is used to update locally cached information of  a PI-SDK object. 

 

object.Refresh TargetObject

The Refresh method syntax has these parts:

Part

Description

object

An object expression that evaluates to a PISDK object .

TargetObject

A PI-SDK object to be refreshed.

 

Remarks

PI-SDK objects on the client provide a copy of information stored on the server. This information grows stale over time and may be invalid due to changes made to the server by other users. When a modification is made to a PI-SDK object that affects the Server, the local object typically reflects the modification. Changes made by other processes or from programs on other nodes are not reflected until the new information is retrieved. If the information has never been accessed then it will be retrieved correctly when first referenced. If the program is already holding a copy of the information it may need to be refreshed by calling this method.

The Refresh method provides a way to ensure the currency of information at the cost of extra retrievals from the server.

Refresh acts in a hierarchical fashion, following the object model. Refreshing a top level object will result in all its loaded children and their descendants also being refreshed. Care should be taken to avoid costly refreshes.

The implementation of Refresh may use lazy evaluation. When calling Refresh on a particular object it may just mark its data as dirty and wait for the client to call to retrieve information before actually refreshing its cache from the server.

In later releases of the PI-SDK some of the cached information will be updated dynamically by the PI-SDK as it changes on the server, rendering the Refresh method unnecessary. Some information, especially in older servers, may never be available dynamically and the Refresh method will continue to provide assurance of currency.

Refresh is implemented by PI-SDK objects that support the IRefresh interface. An object can be refreshed by obtaining this interface and calling the Refresh method. Alternately a program can call this high level Refresh, passing any PI-SDK object and the method will obtain the IRefresh interface if one is available and do the refresh on the caller's behalf.

 

Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur.  Note each object may have its own responses to the IRefresh call that pertain to specific problems encountered in refreshing the particular object.

Error

Description

E_NOINTERFACE

(0x80004002)

The passed object does not support the IRefresh interface.

pseDISCONNECTED

The connection to the server has been lost.

Enabling Operational Intelligence