-
Re: AFCache class - which objects and collections are cached?
RJKSolutions Mar 6, 2013 1:32 PM (in response to MikeRay)My take is that essentially any of the static methods with the verb "Load" or "Find" on an object will cache the object for 120 seconds (by default) so they are not taken by GC. For example, on an AFElement if you "LoadParents" then those objects get cached, but if you "GetParents" those do not.
-
Re: AFCache class - which objects and collections are cached?
MikeRay Mar 7, 2013 3:54 AM (in response to RJKSolutions)Thanks Rhys, can anyone from OSIsoft elaborate more on this please? Are whole load / find result collections cached?
Thanks,
Mike.
-
Re: AFCache class - which objects and collections are cached?
cmanhardMar 8, 2013 1:49 AM (in response to MikeRay)
Rhys summed it up pretty well. The cache is used to hold onto all "transactable objects - things you check-in/out". Its purpose is to delay their garbage collection so that the AF SDK isn't continually reloading objects from the server. So, yes, whole load/find result collections are added to the cache. Implicit loads of collections: (Database.ElementTemplates, Element.Elements, etc) are also cached. Non-transactiable collections (Element.Attributes, Element.Categories) are not put in the cache directly - they are held as long as the owning transactable objects are not GC'd.
It is possible to turn caching completely off, or reduce it and write your own. For example, the AFExport utilitly significantly reduces the cache because it doesn't revisit most objects more than once. The export utiliity holds things that it knows will reused in memory (templates, categories, reference types).
-
Re: AFCache class - which objects and collections are cached?
MikeRay Mar 8, 2013 9:09 AM (in response to cmanhard)Thanks Chris, this gives me a better understanding. We are indeed trying to decide if we need to make our own caching mechanism in our application. Just one final thing to confirm, a cache is held on the client per user connected to the server, is this correct?
Cheers,
Mike.
-
Re: AFCache class - which objects and collections are cached?
cmanhardMar 8, 2013 1:40 PM (in response to MikeRay)
Trick question. AFCache itself is only used to prevent GC of objects. While the AFCache itself is shared amongst all users, objects inside are never shared between users.
-
-
-
-