Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFDataCache.Add Method

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFDataCache.Add Method
Adds a list of AFAttribute objects to be managed by AFDataCache. The AFAttributes are reference counted. Adding AFAttribute that is already in the AFDataCache will increment the reference count and not generate error. Adding the same AFAttribute multiple times will require the same number of Remove call to actually remove the AFAttribute from the AFDataCache.

Namespace:  OSIsoft.AF.Data
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public AFKeyedResults<AFAttribute, AFData> Add(
	IList<AFAttribute> signupList,
	AFDataCacheUpdateOption updateOption = AFDataCacheUpdateOption.DataPipe
)
Public Function Add ( 
	signupList As IList(Of AFAttribute),
	Optional updateOption As AFDataCacheUpdateOption = AFDataCacheUpdateOption.DataPipe
) As AFKeyedResults(Of AFAttribute, AFData)

Dim instance As AFDataCache
Dim signupList As IList(Of AFAttribute)
Dim updateOption As AFDataCacheUpdateOption
Dim returnValue As AFKeyedResults(Of AFAttribute, AFData)

returnValue = instance.Add(signupList, 
	updateOption)
public:
AFKeyedResults<AFAttribute^, AFData^>^ Add(
	IList<AFAttribute^>^ signupList, 
	AFDataCacheUpdateOption updateOption = AFDataCacheUpdateOption::DataPipe
)
member Add : 
        signupList : IList<AFAttribute> * 
        ?updateOption : AFDataCacheUpdateOption 
(* Defaults:
        let _updateOption = defaultArg updateOption AFDataCacheUpdateOption.DataPipe
*)
-> AFKeyedResults<AFAttribute, AFData> 

Parameters

signupList
Type: System.Collections.GenericIListAFAttribute
List of AFAttribute objects to be added to the AFDataCache.
updateOption (Optional)
Type: OSIsoft.AF.DataAFDataCacheUpdateOption
Specifies whether the AFDataCache will automatically populate the cache with data pipe events. If the application is the main data source and will be actively writing data to the AFAttributes, then use "Manual" update option when adding these AFAttributes to the AFDataCache. The update option of an existing AFAttribute in the AFDataCache cannot be changed once the item is added to the AFDataCache. Change of the update option for an attribute can only be accomplished with calling Remove and then Add method.

Return Value

Type: AFKeyedResultsAFAttribute, AFData
An AFKeyedResultsTKey, TResult instance containing a collection of AFData objects corresponding to the passed AFAttributes. These AFData objects are cache aware so that data access methods called from them will attempt to retrieve the data from the cache. If the requested data range is not in the cache, then the data will be retrieved via the normal channel. Any errors that occurred when adding the AFAttributes to the data cache are returned in the error collection of the AFKeyedResults.

Remarks

Be default, AFDataCache uses the AFDataPipe to populate the run time events in the cache. If the application is the data source for an AFAttribute managed by the AFDataCache, e.g. a streaming calculation application, and need to read data from the AFAttribute, updating data from the AFDataPipe through the system of record could result in delay. An application such as this should turn off the use of AFDataPipe as data source of cache events with the update option set to Manual when adding the affected AFAttribute to the AFDataCache. Then uses the WriteToCache Overload method to write events to the cache for the "Manual" AFAttribute. Events sent to the cache via WriteToCache method are not sent to the system of record. Bulk write call like UpdateValues Overload should be used to write to system of record for performance.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in