e106199 wrote:
Otis wrote:
The thing with caching is that it only works for single entity fetches and also only if you read the entities much more often than they're written.
why would it only work for single entity fetches? i cant cache an entity collection?
In short: of course you can, but a collection retrieval is based on a filter, and you then have to filter the cache AND the db.
entities are read a lot more than they are written but its not that a students data is looked up 100+ times a day either.
Then I wouldn't bother and read it from the db.
any suggested tools or ways to measure and compare the performance gain/loss for both scenerios?
Profile the app, which can be a bit complicated in this case. The thing is that caching on a single entity basis only helps if the overhead of dealing with a cache (so checking if an entity is updated, if so, update the cache etc.) is lower than reading it from the db (which is very fast). Also, if you fetch collections of entities which are cached, you have a problem as you then have to filter cache + db contents, which is MORE overhead. See:
http://weblogs.asp.net/fbouma/archive/2006/08/31/Why-a-cache-in-an-O_2F00_R-mapper-doesn_2700_t-make-it-fetch-data-faster_2E00_.aspx