0

I want to refactor some existing code.

A controller with two actions.

Each action calls a repository which is layered on top of a StronglyTyped enterpriseLibrary cache manager.

The repository tries to get data from the cache. If it fails it gets it from the DB and saves it in cache.

1) Would you combine the two caches into one (not) strongly typed cache, with two consumers that will handle the casting to strong types?

2) What are the advantages and disadvantages of each FW? http.cache vs. EnterpriseLibrary.cache

Any other suggestion?

Leigh
  • 28,765
  • 10
  • 55
  • 103
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
  • 2
    First highlight what is wrong: what disadvantages are you experiencing with one or the other? Both are generally reliable with no "Don't use this for that" stigma attached. – Grant Thomas Jan 08 '13 at 15:55

1 Answers1

0

The enterprise library cache will require a bit more work. Its meant to be more all encompassing. The asp.net Cache is specific to asp.net and has a lot of functionality that you need already built in (however it is specific to asp.net). One specific example is that the ASP.NET cache will differentiate between sessions as is. You would have to custom implement the logic to differentiate between session caches with the enterprise library cache.

Now to your specific problem. The asp.net cache is not really designed as is for web farm scenarios. Are you on a web farm? The reason i ask, it sounds as though from your question that the providers they created may be accessing a caching server of some sort.

Scott Stevens
  • 390
  • 1
  • 7
  • There isn't really enough info here to properly address (1). At my organization, before a large change to the caching mechanisms were made, we would likely have a 2 hour discussion going over why the change should be made. really, it comes down to a judgement call. Are the two caching mechanisms doing the same thing? Storing the same data? Storing them in the same location? Do they have the same expiration policies? When I refactor I do so for two main reasons, mainly does it improve readability or efficiency. Will combining the two accomplish either of these goals? – Scott Stevens Jan 09 '13 at 16:29