Also be aware that you can share client vars across servers.  Sessions are a
bit trickier...  If your application needs to scale, you may have to convert
to client vars.

Also, in the session scope, you can store structures.  You can't do that
with client vars.

-----Original Message-----
From: Ben Doom [mailto:bdoom@;moonbow.com] 
Sent: Friday, November 01, 2002 6:51 AM
To: CF-Talk
Subject: RE: client vs. session


It all becomes clear.  Thanks a lot.


  --Ben Doom
    Programmer & General Lackey
    Moonbow Software

: -----Original Message-----
: From: Matt Robertson [mailto:matt@;mysecretbase.com]
: Sent: Thursday, October 31, 2002 11:36 PM
: To: CF-Talk
: Subject: RE: client vs. session
:
:
: Session vars are stored in memory (only) and are meant for short-term
: persistent variable storage.  You have to CFLOCK them, although there
: have been some changes to this with the advent of CFMX.  Your typical
: default session var expires after 20 minutes of inactivity.  However,
: assuming the max expiration time has been extended in the CF
: Administrator, you can expire them after a longer period of time.
: Session vars do not scale across a server cluster since they are held in
: a particular server's memory.  Session vars are structures, so you have
: the ability to natively store complex values within them, like arrays.
:
: Client variables were intended for longer-term persistent value
: storage... Expiration times measured in days; not minutes.  They are
: stored either in the Windows registry (or a facsimile thereof on *nix
: systems), an external database or in cookies.  Since they are not stored
: in memory you do not need to CFLOCK them.  Client variables are meant to
: hold simple values, and do not natively support the storage of complex
: values like arrays.  Since a client var can be stored in a db (or I
: suppose in a cookie) it can be used for persistent storage in a
: clustered server environment.
:
: Client vars can be extended so they expire just like session vars.  Put
: something like this in an application.cfm:
:
: <cfset
: variables.VisitChk=DateCompare(DateAdd('n',(20*-1),CreateODBCDateTime(NO
: W())),client.LastVisit)>
: <cfif Compare(variables.VisitChk,"-1")>
: .. Uh oh.  20 minutes of inactivity have passed.
: Delete the user's cvars...
: </cfif>
:
: Using WDDX you can even use them to store complex structures if needed.
: That tutorial I mentioned in another thread (at http://halhelms.com)
: will spell all that out, and explain the expiration thingie I copied,
: above.
:
: What did I miss?
:
: --Matt Robertson--
: MSB Designs, Inc.
: http://mysecretbase.com
:
:
:
: -----Original Message-----
: From: Ben Doom [mailto:bdoom@;moonbow.com]
: Sent: Thursday, October 31, 2002 8:15 PM
: To: CF-Talk
: Subject: client vs. session
:
:
: I read up a bit on client and session scopes, and am a bit confused.
:
: Can someone explain to me the difference between them?  All I can really
: find is that I have a bit more control over where, for example, session
: variables are stored.
:
: Feeling unscoped....
:
:
:   --Ben Doom
:     Programmer & General Lackey
:     Moonbow Software
:
:
: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to