I do this frequently.  Works well.

Jaime 

> -----Original Message-----
> From: Rick Root [mailto:rick.r...@webworksllc.com] 
> Sent: Monday, 9 February 2009 9:51 AM
> To: cf-talk
> Subject: dynamic names for named locks
> 
> 
> Is it possible to use named locks with dynamic names?
> 
> I've got a site running a single application under thousands 
> of domains.
> 
> Site information for each domain is stored in the application 
> scope so I don't have to get it from the DB all the time.
> 
> So my first lock looks like this
> 
> <cflock name="appInitLock1" type="exclusive" timeout="30">
>       <cfif not structKeyExists(application,"sites") or NOT
> isStruct(application.sites) or isDefined("url.reinit") or 
> isDefined("url.init")>
>               <cfset application.sites = structNew()>
>       </cfif>
> </cfif>
> 
> My second piece that is locked is specifically to get or set 
> the detail within the application.sites struct with the site 
> specific information.... based on the domain name.
> 
> So while many threads *MAY* execute the code, only threads 
> making a request to the same domain would need to be 
> protected from each other.
> 
> So I was thinking about doing a named lock with a dynamic 
> name based on the domain... ie:
> 
> <cflock name="appInitLock2_#replace(request.domain,".","","ALL")#"
> type="exclusive" timeout="30">
> 
> Would this work and can anyone think of any reasons NOT to do this?
> 
> Thanks.
> 
> Rick
> 
> 
> 
> -- 
> 
> Rick Root
> New Brian Vander Ark Album, songs in the music player and 
> cool behind the scenes video at www.myspace.com/brianvanderark
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319092
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to