Caching Pattern for read-through/write-behind cache with fallback to underlying data store

StackOverflow https://stackoverflow.com/questions/20289841

Question

I'm looking to implement a caching layer with read-through/write-behind approach, but possibility to fall back to directly accessing data store in case of cache failure.

I'm thinking to have business layer go through a "Cached Data Layer" that will then access data layer if cache is unavailable or get data from cache. The cache provider (AppFabric in this case) will have a read-through/write-behind implemented with the same interface as my data layer.

But my approach seems overly complicated to me.

Can anyone point me in the right direction?

Était-ce utile?

La solution

It doesn't feel overly complicated to me. In fact, it seems like a pretty typical example context in which to use the proxy pattern. The caching wrapper would implement the same interface as the actual data layer it would encapsulate.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top