I have a server application (using PI AF Client) to connect our specialised clients to AF data (no direct PI AF Client on our clients and WebAPi not possible at the moment)
The server is 'long lived' and will access many elements/attributes, and the same element/attribute many times, so I'm interested doing this efficiently
Our clients reference AFAttributes using their full string path
I currently query AFElements.FindElementsByPath() every time a client requests some data, and then iterate through the attributes to find the ones I want but it would seem better to either ...
a) fetch AFElements once into my own lookup by path as a cache, use them repeatedley, and iterate through the attributes when needed
b) or ... fetch and hold AFAttributes in my own lookup as a cache and just use them repeatedley and over a long period as needed by the clients
1) Would a) or b) work properly (can I cache AFElement and AFAttribute on 'my' side)... and also would it work over a long period of time, for instance if an AF server was restarted during that time period
2) If I hold AFElements or AFAttributes in a local cache, should I expire them and refetch them after a certain period... do they go 'stale' in any other way
3) Will I need to 'refresh' the attributes at all to get data that reflects recent changes at the PI AF Server end... (snapshots, summaries, interpolated, recorded) ?
4) Is there a better or more efficient way of thinking about this.... for instance would it be better to cache the element/attribute ID (obj.ID) and using AFElement.FindElement( system, ID) each time
I've looked through the docs today but so far not found any hints... is there a specific document that would address this kind of thing
I intend to call ... AFElement.LoadElements( <elementlist> ) ... after finding elements for the first time