Where do I place my Cache Layer?

You can virtually place your Cache access operations (read/write) wherever you have data, but in order to design modular and maintainable software it’s a good idea to centralize these operations into a separate layer to encapsulate and prevent ripple effect when changing the underlying provider (imagine that you start using Memcached, however your design should be good enough to allow a migration to somewhere like AppFabric Caching Service). Now the question is: where does exactly in my design fit the Cache layer?

The worst answer I can think of it’s replying with only one possibility. As a software Designer/Architect you should consider many scenarios and chose the best. Avoid facing your design decisions with a golden hammer / silver bullet. A common poor answer is placing the Cache layer between your Business and Data Layers. Another common answer is placing it between the Data Layer and the underlying data store.

The best thing to do is checking all the possibilities and assesses them according to your needs. In my experience I prefer caching in UI Components, UI Process Components, Data Access Components or in Service Agents because those scenarios offer performance improvements.

Another factor that can influence your decision is if you want caching fine-grained or coarse-grained data. I mean, you can opt between caching a plain query result or an UI-Entity collection ready to be consumed by the front-end.

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP
Intel Black Belt Software Developer
About these ads

4 respuestas a esta entrada.

  1. [...] Where do I place my Cache Layer? [...]

    Responder

  2. [...] I discussed about the best place to put the Cache layer from an architectural point of view. The main ideas of that discussion are summarized as [...]

    Responder

  3. [...] Previously I discussed about some places to put the Cache layer from an architectural point of view. The main ideas of that discussion are summarized as [...]

    Responder

  4. [...] I discussed about some places to put the Cache layer from an architectural point of view. The main ideas of that discussion are summarized as [...]

    Responder

Deja un comentario

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Conectando a %s

Seguir

Recibe cada nueva publicación en tu buzón de correo electrónico.

%d bloggers like this: