No, you don't have to lock client variables as the database will take care
of that for you.  You only need to lock variables that reside in RAM
(session, application, server).  Although I'm not sure how scalable it would
be if Access is your database.  On a different issue, isn't the attached
code a bad idea?  I was given the impression that it's not a good idea to
monkey around manually with CFs client variable database.

Bob

-----Original Message-----
From: W Luke [mailto:[EMAIL PROTECTED]]
Sent: March 23, 2001 3:03 PM
To: CF-Talk
Subject: Re: session variable locking question


Should client variables such as the following be inside a <cflock>?

<CFIF DateDiff("n", Client.LastVisit, Now()) GTE 360>
        <CFQUERY NAME="delClientVars" DATASOURCE="localads" MAXROWS=1>
            DELETE FROM CData
            WHERE CFID = '#Cookie.CFID#:#Cookie.CFTOKEN#'
        </CFQUERY>
  <cfset logged = False>
    </CFIF>
<cfif NOT IsDefined('Client.IsLoggedIn')>
<cfset logged = False>

<Cfelse>
<cfset logged = True>
<!-- User logged in as <cfoutput>#client.email#</cfoutput> --><p><p>
</cfif>

Will
--
[EMAIL PROTECTED] -=- www.lukrative.com
Local-Advertising -=- www.localbounty.com

> it is better to wrap the whole hting inside the cflock....
>
> <cflock scope="Session" type="ReadOnly" timeout="5">
> <cfif IsDefined("Session.user")>
> <CFSET REQUEST.USER = Session.user>
> </cfif>
> </cflock>
>
>
> the reason?  Because what if it was read an existing session variable from
> another thread?  See?  wait, i dont know what I'm saying.  dont listen to
> me.  argh
>
> -----Original Message-----
> From: Tim Bahlke [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 22, 2001 2:15 PM
> To: CF-Talk
> Subject: session variable locking question
>
>
> In the following code, do I need a lock around the entire cfif statement?
>
> <cfif IsDefined("Session.user")>
> <cflock scope="Session" type="ReadOnly" timeout="5">
> <CFSET REQUEST.USER = Session.user>
> </cflock>
> </cfif>
>
> Is it better to declare [lock]<cfparam name="Session.user"
default="">[lock]
> instead of the IsDefined function?
>
> Thanks,
>
> Tim Bahlke
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to