Where does <cflock> go? Should it be located in the Application.cfm file, or can it be placed in any arbitrary .cfm file?
<CFLOCK SCOPE="Session" TYPE="Exclusive"
TIMEOUT="30" THROWONTIMEOUT="Yes">
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It can be placed in any file.
However, don’t just use it everywhere without thinking – too much locking can be just as bad as not enough locking.
In particular, be careful not to create deadlocks (by placing competing locks that might both end up waiting for the other to complete, meaning neither of them can process).
There is useful info (including some good links) here: How to make a shared resource thread-safe when using dependency injection?
You can also look at questions tagged with both coldfusion and locking for more interesting reading: https://stackoverflow.com/questions/tagged/coldfusion+locking