You use a cache so you don't need to reread the data from the data source. If you're after performance, you want to be able to read from a memory store right on the web server rather than from a database... typically.
Caching and collections don't have anything to do with each other. You can cache a collection or not. Caching just provides another tool to use to tune your application. Like all other tools, it needs to be used correctly and when it makes sense or could cause more harm than good.
Also, having a separate dll for the data access doesn't matter. The important thing to consider is to encapsulate your logic and layers in such a way that you can intelligently add caching as needed.
For example, in a high-performance environment, you might have strategies for certain data access. For an online store I worked on, we cached inventory information and then updated individual records in the data store and cache as inventory updates came along. We had logic built in to detect when massive inventory updates came in and would, at that point, flush the entire cache and just re-read from the data store.
|