1

One of my friends wants to use AppFabric caching on server side (WCF services).

But to reduce similar functionality across services code, he wants to cache data "automatically" using AOP Postsharp + AppFabric cache.

Is it wise to use automatically caching in such style on server side?

Regfor
  • 8,515
  • 1
  • 38
  • 51
  • What are you asking about? The caching using appfabric or the automated application of caching code via an aspect? – Dustin Davis Aug 11 '11 at 23:13
  • I am asking about automated data caching (into AppFabric cache)using postsharp aspects. Is it wise to handle cache automatically in such way or it's better to handle it manually through code – Regfor Aug 12 '11 at 22:04

1 Answers1

1

The real question is: Does it make sense for your project? It is acceptable to automatically cache output from a method using aspects. It's less code you have to write and manage. Caching is a cross-cutting concern which is where AOP comes in. PostSharp is the leading AOP framework in the .NET world.

So, if you have code that does caching and you've tested it and it's proven then put it into an aspect and use it, then reuse it. It doesn't matter if it's local memory or app-fabric. If it makes sense then do it.

It's the same as you manually writing the code everytime, except you only need to write it once and PostSharp "writes" it for you where you tell it.

Dustin Davis
  • 14,482
  • 13
  • 63
  • 119
  • yes, you are right. But I think making some actions, especially with caching on server/service application is risky, because there is risk that code, which is reused in many places is buggy or has low performance. Also there is risk that another developer, who understands not fully how to use such attribute, could use this attribute in wrong places. And it will cause a bad performance. Such faults are very critical for highload service applications. – Regfor Dec 18 '11 at 20:35