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:226341
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