Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Session Management

Can I save myself from CFLOCKING Sessions? by webmigit
Posted: 14 May 02 (Edited 20 Sep 02)

Before reading this FAQ, I suggest that if you're new to CFLOCK and/or sessions that you read up on them.

CFLOCK in a simple explanation to suit this FAQ sets cold fusion (a language engine that generally handles multiple threads) to a single thread type until the locked process is done or times out. If you use the name attribute of CFLOCK, well then it single threads in a queue all cflocks with that name.. IE 30 different locks may be in your application and if 5 have the same name, then if 2 or more lock instances with the same namese 5 are accessed simultaneously CF handles them on a first come, first serve basis.. But other processes with different lock names can be accessed at the same time. This is to help keep your application running smoothly without corrupting itself.

I was presented with an application that has about 500 calls to session variables in it, and none of them were locked, it was going to be my job to lock every read on a session variable.. But I found that session variables are stored in the memory and client variables (application,cookie,request) are stored on a page by page basis in a basic definition.. so I could, in application.cfm code the following:

<CFLOCK timeout="30" name="SetGlobalUser" type="Session">
 <CFSET suser = session.username>

By doing it this way, I could call it as suser from anywhere in the application, even custom tags.. by calling #caller.suser#.

Because this was then set as a page variable.. I didn't need to lock and could use it, read from, write to it freely.. I was able to return to the client a fast application with only minutes of work invested, rather than hours as it would have taken by manually putting in every cflock.

I hope you find this useful.

Tony Hicks

Back to Adobe FAQ Index
Back to Adobe Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close