Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So you basically want to dependanct inject a cache provider that only returns certain types? Isn't that kind of against everything OOP?</p> <p>The idea of the "object" type is that anything and everything is an object so by using a cache that caches instances of "objects" of type object you are saying you can cache anything. </p> <p>By building a cache that only caches objects of some predetermined type you are limiting the functionality of your cache however ...</p> <p>There is nothing stopping you implementing a custom cache provider that has a generic constraint so it only allows you cache certain object types, and this in theory would save you about 2 "ticks" (not even a millisecond) per retrieval.</p> <p>The way to look at this is ...</p> <p>What's more important to me:</p> <ol> <li>Good OOP based on best practise</li> <li>about 20 milliseconds over the lifetime of my cache provider</li> </ol> <p>The other thing is ... .net is already geared to optimise the boxing and unboxing process to the extreme and at the end of the day when you "cache" something you are simply putting it somewhere it can be quickly retrieved and storing a pointer to its location for that retrieval later.</p> <p>I've seen solutions that involve streaming 4GB XML files through a business process that use objects that are destroyed and recreated on every call .. the point is that the process flow was important not so much the initialisation and prep work if that makes sense.</p> <p>How important is this casting time loss to you? I would be interested to know more about scenario that requires such speed. </p> <p>As a side note: Another thing i've noticed about newer technologies like linq and entity framework is that the result of query is something that is important to cache when the query takes a long time but not so much the side effects on the result. </p> <p>What this means is that (for example): If i was to cache a basic "default instance" of an object that uses a complex set of entity queries to create, I wouldn't cache the resulting object but the queries. </p> <p>With microsoft already doing the ground work i'd ask ... what am i caching and why?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload