Is there any easy way to implement a read-through and write-behind cache?

I did not find any information on the Internet or in the Couchbase documentation about read-through and write-behind caches, but they were mentioned in the User Panel "Using NoSQL to Replace a Caching Tier" (http://www.youtube.com/watch?v=GJWyX-uizmU). Does anyone know how to implement or setup read-through and write-behind in the cache?

1 Answer

« Back to question.

Hello,

We do not have specific logic here. This is really something that is based on your application/architecture.

You just need to find a way to calculate keys, based on the data your read from the database, and put that in Couchbase, same when you write/delete. And also chose if you want to use an expiration.

May be if you give us more information about your application we can provide more concrete example/logic.

Regards
Tug
@tgrall

Thanks Tug. I think I wasn't clear in what I wanted. I want to use Couchbase a a caching tier for .NET applications using SQL Server or Oracle as database systems. AppFabric 1.1 enables read-through and write-behind using a user-defined provider. That makes programming very easy (just access the cache). I had that in mind. I know that it can lead to problems (the provider can fail, write is deferred what could cause item loss if the cluster goes down a.s.o.). But if the provider is carefully implemented and tested it works. NCache obviously enables read-through and write-behind as well, but I did not check that yet. If I had to implement that myself (in the data access layer), read-through would not be a problem, but write-behind is not so easy considering deferred database updates to avoid heavy database load.