There was a thread not long ago about storing them in the application scope.
It sounded reasonable but I haven’t tried it so I can't elaborate on any
performance issues it might cause or clear up. You should be able to find
the thread in the archives.

..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com


-----Original Message-----
From: Ryan Duckworth [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 06, 2005 5:54 PM
To: CF-Talk
Subject: cfscript Common Functions and Best Practices

Currently we have many functions that we use within cfscript.  We are
storing them in the request scope (see 2 examples below).


Here is what I am don't like about this approach:  Every page hit from
every user is loading these common functions.  I personally am not
convinced that the request scope is the best place for these types of
functions.  I'm sure that many of you out there use functions of your
own and from www.cflib.org.  Is the server scope a better place for
these?  Should we only reload the functions if they are not already
defined in the server scope?

Thanks,
Ryan


<cffunction name="abort" output="false" returnType="void">
<cfabort>
</cffunction>

<cffunction name="sleep" access="public" returntype="void" output="No">
<cfargument name="milliseconds" type="numeric" required="No" default="1000">
<cfset
createObject('java','java.lang.Thread').sleep(arguments.milliseconds)>
</cffunction>

<cfscript>
request.abort = abort;
request.sleep = sleep;
</cfscript>


Call from within cfscript tag:
request.sleep(3000);
request.abort();



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226343
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