Duncan,
without seeing the CFC (was about to say object but stopped myself), it's
hard to say whether making the ... hmm ... CFC stateful would alter the
functionality, but you could also instantiate the CFC into application scope
once, and then call it from within your applications ...
roughly something like :
<cfif NOT StructKeyExists(application,"myVarPass")>
<cflock name="thisSiteLock" Timeout="10" THROWONTIMEOUT="No"
Type="Exclusive">
<cfif NOT StructKeyExists(application,"myVarPass")>
<cfset application.myVarPass =
createObject("component","CFC.varpass")>
</cfif>
</cflock>
</cfif>
And then do this on each request
<cfset application.myVarPass.varpass(url,"URL","displaymode")>
You'd just need to make sure that it doesn't maintain state in a way that
you don't want, in other words, every time you call
"application.myVarPass.getVars()" or whatever method you're using to get the
variables, you get a different result. Instatiating a CFC into application
scope allows you to hold data in there that will persist until the
application times out, but for this particular use, you don't want that.
The only benefit is you'll shave a few milliseconds from your page
processing time, and really just a very few, off each request. If i were
doing only what you're doing, i wouldn't bother. But it's good to know from
the get go that you can use application scoped CFC's to process, store and
retrieve application wide data. Very convenient, and powerful once you get
into, hmmm, a little more of an object oriented approach ... if you ever
feel like it one day.
:) n.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Duncan
Sent: Tuesday, April 05, 2005 9:09 AM
To: [email protected]
Subject: [CFCDev] calling a cfc
I am new o CFC's and trying out the processes with them, and I have
the following code calling this one cfc, it does it on every request
and its one that I have put outside the webroot, with a maping to the
dir so we can share it between the applications on the server.
<cfinvoke component="/CFC/varpass" method="varpass"
returnvariable="varpass" stAttribs="#url#" style="URL"
exceptions="displaymode" />
the /cfc/varpass bit doesnt rub well with me, can I use some this.that
notation to call it? How do I set that up?
Also because it gets used on every single request is there a better
way to set it up?
Thanks
--
Duncan I Loxton
[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]