share data between applications using CAB 2.0

Topics: Caching Application Block , General discussion
Apr 29, 2007 at 1:20 PM
Edited Apr 29, 2007 at 1:46 PM

I have 5 applications under the same IIS server(intranet enviroment), and i need to share data between them, because the user can do something in one application and then, navigate to another application, and based on the data that came from the first application he can continue to modify data in the second app, and so on...I don't want to use SQL because performance issu, and i need to store objects, like: XmlDocument, XmlNodes, arrays, etc...So, i tought to use cache to store this data and get it from any application, and i have the following questions:

1. Did cache data stores between diferent virtual directory under same IIS(i mean if i store data in one application and from this application i navigate to another one, and so on..)?

2. If i need to store the same objects for each user in specific page, like different XmlDocuments, and in my code i write something like this:

CacheManager cacheManager = CacheFactory.GetCacheManager();
cacheManager.Add("Key1", XmlDocument, CacheItemPriority.Normal, null, new SlidingTime(TimeSpan.FromMinutes(120)));

cacheManager.Add("Key2", string, CacheItemPriority.Normal, null, new SlidingTime(TimeSpan.FromMinutes(120)));

and in the same page i have 10 diferent users that need to save the same objects simultaneously, it create 10 diferent cache store for each user in the same applicaion? or, because the 'key' for the object is same, each user that save his data will override the last user who save his data?

If so, if each user override the other user data, how can i solve this problem?

thank you...
Apr 30, 2007 at 3:37 PM
If you plan on sharing a single cache among different applications, it is ill-advised according to the documentation-

"You should deploy the Caching Application Block within a single application domain. Each application domain can have one or multiple caches, either with or without backing stores. Caches cannot be shared among different application domains."




David Hayden
Microsoft MVP C#