DEV Community

Discussion on: Multilayer Caching in .NET

Collapse
 
sarafian profile image
Alex Sarafian • Edited

Unfortunately, the organization I worked for back then was not open source friendly. The implementation was left at a proof of concept but I generally tend to build my POCs well so it was good. It was with full .net framework.

To give you some context, the application I worked for was built over a domain that is very file system oriented which worked for rich clients but we had issues with porting to Web (It's called DITA). Additional to that, we had some performance issues and because the back end was stateless, in memory caching was not an option as it would add state. So the team was stuck in general and had always chosen to avoid caching and focus on performance which really were really good at. They had the best SQL programmers I've met to be honest. My role as an architect was to provide a foundation on how to add this capability to the stack and this is what the POC did. It was never adopted though because of prioritization and general lack of understanding of how to cache.

If you ask me, it is not about the how but first and foremost about understanding about is being cached and what are the implications. You need first to classify your data in terms of volatility, cost but most importantly on impact of staleness. And this is the biggest exercise of all and carries the biggest risk because inevitably it will change the behavior of some parts of the app. Most shops I've worked with have a severe problem on exactly this topic and haven't thought about their data, besides performance. More agile and more modern stacks refer to this part of the problem with the "eventually consistency" which scares traditional teams and their customers and not without justification.

I've explained this because the implementation was not that difficult to be honest. It was simpler than I expected for my self because cache is easy. But, what the biggest problem was the above. And that becomes even more complicated when the type of cache provides change because they connect function with choice and architecture.

Thread Thread
 
turnerj profile image
James Turner

That was really interesting, thanks for sharing!

If you ask me, it is not about the how but first and foremost about understanding about is being cached and what are the implications. You need first to classify your data in terms of volatility, cost but most importantly on impact of staleness.

This 100%. I've seen caching solutions where they just cache everything but later wonder why they run into obscure issues with the data. Not putting the right data for an appropriate amount of time in a cache can severely impact both performance and code maintenance.