Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to design an ASP.NET MVC site for caching with Velocity?

I'm coming from the LAMP world, where the "cache everything" mentality is prevalent. Everything is put in memcache.

I'm starting a new project with ASP.NET MVC and SQL Server. I'll probably go with LINQ to SQL or maybe Entity Framework. Are there design decisions I need to make now for caching, or is it easy enough to start using Velocity if that becomes necessary? Just to be clear, I'm talking about Microsoft's Velocity cache and not the Apache Velocity template engine.

I'm hoping that I can ignore caching for the moment, because learning C#, ASP.NET MVC, LINQ, IIS, SQL Server, and becoming proficient in VS is keeping my plate full.

like image 725
royco Avatar asked Jan 24 '09 18:01

royco


2 Answers

Stephen Walther has a great article on how to do this

ASP.NET MVC Tip #39 – Use the Velocity Distributed Cache

like image 77
dswatik Avatar answered Oct 26 '22 14:10

dswatik


dswatik provided a great link on how to use it.

I'd suggest adding this functionality somewhere in your Repository/Service layer to take the burden off of the application and to stay within the DRY principle.

like image 26
Chad Moran Avatar answered Oct 26 '22 15:10

Chad Moran