code_junkie

Coldfusion - When to use the “request” scope?

Nov 10th, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <cfif not structKeyExists(application, "dsn")>
  2. <cflock scope="application" type="exclusive" timeout="30">
  3. <cfif not structKeyExists(application, "dsn")>
  4. <cfset application.dsn = "MyDSN" />
  5. <cfset foo = "bar" />
  6. <cfset x = 5 />
  7. </cfif>
  8. </cflock>
  9. </cfif>
  10.  
  11. <cfcomponent>
  12. <cfset this.name = "myApplicationName" />
  13.  
  14. <cffunction name="onApplicationStart" returnType="boolean" output="false">
  15. <cfset application.dsn = "MyDSN" />
  16. <cfset foo = "bar" />
  17. <cfset x = 5 />
  18. <cfreturn true />
  19. </cffunction>
  20. </cfcomponent>
  21.  
  22. <cfif not structKeyExists(application, "dsn")>
  23. <cflock scope="application" type="exclusive" timeout="30">
  24. <cfset application.dsn = "MyDSN" />
  25. <cfset foo = "bar" />
  26. <cfset x = 5 />
  27. </cflock>
  28. </cfif>
Add Comment
Please, Sign In to add comment