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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top