views:

71

answers:

1

Dear All

I am trying to do an C# implementation of Write-through Cache to minimize the read hits on db i need your suggestions, articles or sample codes to fulfill this assignment.

Initially this would be use only on one server but will be updated to work in clustered environment.

I only able to get a worth reading article on Oracle Site.

Please share your views

Regards Mubashar

+2  A: 

The easiest thing to do would be to cache at a higher level than the database-connectivity level. If you have a data access layer that encapsulates you from the nitty-gritties of SQL, that's usually a good place. If you have a place where data objects are requested, that would be even better; your caching key can be the identity of those objects.

What you ultimately will probably want is a caching Proxy which encapsulates your caching logic, interdicting reads but passing writes through to the underlying service (the object persistence layer or the data access layer). You can use WeakReference to cause unused objects to expire out of your caching collection, in which case you'll need to do just a little bit of clean up. On the other hand you can write your own expiration logic, in which case you have to do more clean up but will retain more control.

Without more specific details, it's hard to give you a specific answer.

Actuall i need some general help as explaining my situation is a bit time take process as i can't do multitasking myself :) Anyway i wanted to implement following sort of thing http://wiki.tangosol.com/display/COH32UG/Read-Through,+Write-Through,+Refresh-Ahead+and+Write-Behind+Caching
Mubashar Ahmad