Matt Robertson wrote:
> Jochem wrote:
>> 
>> I like the idea of using named locks whenever I use cffile. But
>> since I use the MD5 of the filename as the lock name that
>> shouldn't conflict very often :-)
> 
> ah clever.  Salt the hash with the user id and they'll never conflict,
> assuming that doesn't screw something else up  :D

But locks that never conflict are a bit useless, aren't they?

You want locks to conflict whenever 2 threads are accessing the 
same file, regardless of the user that is driving the threads. So 
you don't salt the filename nor the hash. (I do find it good 
practice to prepend the lock name with an alphabetic character 
since a hash can start with 0-9, but that isn't an absolute 
requirement in CF.)

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192530
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to