Caching in middle tier for both Win and Web .How?

Topics: Caching Application Block , General discussion
Dec 29, 2008 at 7:50 AM

Hope you can help.
How can I apply caching in my business Layer?

I have both a Windows Application and WebApplication they both share the same middle tier.
I would like to apply caching in the middle Tier as it's shared by both.

I beleive the above is a very common scenario.
cannot find anywhere where they show how to put into practice this very common scenarios.

Any Suggestions/Links etc... where the Enterprise Caching block has been applied as mentioned above?

thanks as usual
Dec 29, 2008 at 11:08 AM
Are you anticipating any problems or issue that you might encounter? I think the critical thing you must do is to make use of a CacheManagerFactory which takes a FileConfigurationSource pointing to your configuration file containing the caching application block configuration since the business layer is not an executable assembly (configuration files belong to executables, not to dlls).


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com

Dec 29, 2008 at 11:35 AM
Thanks for your reply.
In my case the Business Layer is a dll.
Both Windows and Web will share the same caching application block.

EG
  • MyCompany.Business.Customer.dll
  • MyCompany.UI.Windows.CustomerApplication
  • MyCompany.UI.Web.CustomerApplication.

Both my Windows and Web use the Customer.dll

Now Let's suppose I have a method "GetAllCustomers" in my MyCompany.Business.Customer.dll.
This is used by both Win/Web and it's a candidate for caching.
When either a web or windows  calls this method i want to use the cached version.

Can i use the same caching strategy for both? EG IsolatedStorage or Database caching?

I am sure there are many ways to skin a cat but I cannot find any examples anywhere or what people do in this scenarios.

Also what are the benefit of databaseCaching? We are making a call to a db ?I thought caching was all about avoiding a call to the db.
Am I missing the obvious?Sorry for silly question!!!

thanks again for your time

Dec 30, 2008 at 2:16 AM
Database caching allows you to persist cached data even after the application exits and restarts.  It loads those data and returns them in HashTable form so it doesn't make calls to db everytime you make calls to GetData.  And yes, you can use the same caching strategy for both Web and Windows.  If you don't need to persist data, see if the CachingCallHandler will suit your need.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com