Is there a sequence in which the AppFabric Cache DataStoreProviders get instantiated?
-
Monday, January 30, 2012 1:13 AM
Hi,
I've created and tested DataStoreProviders for my AppFabric Cache Configuration... my configuration contains 3 named caches; actual production scenarios could have more.
I've just implemented my logging application in the provider and I noticed that instantiating the logger in one class is good enough because it's used throughout the cache service instance... multiple tests show that the same cache is always instantiated first.
My problem is I don't know if there is a pre-defined, consistent order in which the cache providers are instantiated or is what i'm seeing just a fluke. Meaning, can I rely on a specific cache provider being always instantiated first or do I need to put my logger initialization logic into all of the cache providers and compensate for redundant initialization.
I'd prefer not to write code to ensure the logger class is only instantiated once if I don't have to.
Thanks!
Thanks, KBW
All Replies
-
Monday, January 30, 2012 1:03 PM
The provider is loaded as soon as the cache is created on the server side. If you create a new cache or change its config, then you are sure that the provider will be loaded immediately when the cache comes online. As you know, the provider is cache name specific and there is no one provider for the entire cluster. You can however choose to load the same provider for all the named caches if you want to.
I assume that you are referring to caches being present in the config and the cluster being started. In that case, there is no order gauranteed. You should ideally handle this in the provider code.
- Marked As Answer by KWeeks Monday, January 30, 2012 1:16 PM
-
Monday, January 30, 2012 1:18 PMThanks. That's what Ithought but wanted to confirm.
Thanks, KBW

