Improving Cache and Session Speed

Posts   
 
    
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 20-Jan-2006 15:18:04   

I have been reading in various articles about how to improve cache and session read / write performance. In many articles it says to store simple value types and try and stay away from using custom objects.

I find this approach to be a bit tedious as you end up with many different items in the dictionary container that holds the session items and cache items For example, if I want to place a person entity in session, I should put the attributes of the person into session and not the person entity. When I need to get the person entity from session I should return an instance of a person entity setting its attributes from the values in session. This seems like a lot of clutter in the dictionary container.

Also in many places the LLBLGen documentation says not to store the entity but store the values from the entity.

Does anyone have a particular design pattern that they use to pull out the values from an entity then recreate an instance of the entity from the values in the session or cache?

As a side thought, I could always use the compact xml and read / write the xml into the cache. Has anyone performance tested this to find out how performant this would be?

I am guessing that storing the attributes of an entity or the xml representation of an entity would use less memory than storing an actual instance of the entity. Has anyone confirmed this?

Thanks for your thoughts.