.NETGURU
cache business objects tied to a user in Cache or Session?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcache' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Francesco Sanfilippo
-- Moved from [aspngarchitecture] to [aspngcache] by Charles M. Carroll <Click here to reveal e-mail address> --Is it more efficient to cache a business object, say a User or Member class, in the .NET Cache object (keyed by the user's SessionID), or directly in the user's own Session object?Francesco_________________________________________________________________Send and receive Hotmail on your mobile device: http://mobile.msn.com
Reply to this message...
 
    
Rob Howard (VIP)
It would be better to store this type of data in Session.

-----Original Message-----
From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]=20
Sent: Sunday, January 13, 2002 9:02 AM
To: aspngcache
Subject: [aspngcache] cache business objects tied to a user in Cache or
Session?

-- Moved from [aspngarchitecture] to [aspngcache] by Charles M. Carroll
<Click here to reveal e-mail address> --

Is it more efficient to cache a business object, say a User or Member
class,=20
in the .NET Cache object (keyed by the user's SessionID), or directly in
the=20
user's own Session object?

Francesco

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

| [aspngcache] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngcache.asp =3D JOIN/QUIT

Reply to this message...
 
    
Francesco Sanfilippo
I thought so, thanks! Second part of question. Is it better to:

1. On Session_Start(), populate Session variables with the user data, and on
each Page_Load(), create a User class whose constructor gathers the data
from Session variables, and is disposed when page is finished.

2. On Session_Start(), create an instance of the User class, populate it
with all the user's data, store it in the user's Session. On Session_End(),
Dispose() of the User instance.

All I'm storing in the User instance are ints, bools, and strings, and of
course, any methods that users can call.

Francesco

[Original message clipped]

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

Reply to this message...
 
    
John Crim
Assuming memory use is roughly equal, do whichever has less page
overhead. If you can avoid some processing work on every page hit with
#2, choose that option (which sounds like the best choice).

The situation where #1 would be attractive is if the User class has 0 or
low overhead ctor/dtor, and the User class consumes waaay more memory
(or holds onto other limited resources) than the Session variables
would.

Regards,

John Crim
WebGecko Software
http://www.webgecko.com

-----Original Message-----
From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]
Sent: Sunday, January 13, 2002 10:49 PM
To: aspngcache
Subject: [aspngcache] RE: cache business objects tied to a user in Cache
or Session?

I thought so, thanks! Second part of question. Is it better to:

1. On Session_Start(), populate Session variables with the user data,
and on
each Page_Load(), create a User class whose constructor gathers the data

from Session variables, and is disposed when page is finished.

2. On Session_Start(), create an instance of the User class, populate it

with all the user's data, store it in the user's Session. On
Session_End(),
Dispose() of the User instance.

All I'm storing in the User instance are ints, bools, and strings, and
of
course, any methods that users can call.

Francesco

[Original message clipped]

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

| [aspngcache] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngcache.asp = JOIN/QUIT

Reply to this message...
 
    
Francesco Sanfilippo
Any other input on this? I just spent all day Sunday writing the class to
operate using method #1, but I will take a day to convert it to method #2 if
everyone agrees it is best.

Francesco

[Original message clipped]

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification