cffaq.com


Hosted and maintained by Ben Forta. Designed by Trilemetry.
Language:
    © 2002-2007 Ben Forta. All Rights Reserved  
<Home> <FAQ> <Question> <About>

Question

When should I use <CFLOCK>?
The purpose of <CFLOCK> is to control concurrent access to a block of code or a scope. Prior versions of ColdFusion (pre CFMX) had a limitation in that unlocked concurrent access to shared scopes (like SESSION or APPLICATION) could result in memory corruption and thus server failure. This is no longer the case in ColdFusion MX, but there are still valid reasons to use <CFLOCK>. Firstly, any code that is not multi-user safe (third party tags, access to file system files, etc.) should be locked to ensure sequential (as opposed to concurrent) access. Secondly, even though not locking access to shared scopes will not cause any server problems, the lack of <CFLOCK> use may cause application irregularities. For example, if an application updates a set of APPLICATION variables and access is not locked, it would be possible for users to access some old variables and some new ones. This may or may not be a problem, that depends on the application, if this is a problem then you’ll want to use <CFLOCK>.

Comments


Add Your Comments

Your Name:
Your E-Mail:
Comment:
Verification: Copy the text on the left:

<submit question>