I tested a combination, one object created in the application scope, and
one in the variables scope:
In both outputs, I get the exact same time. In the application scope I
thought it would be set in the CFC, so next time I would call the CFC I
would get the old time back. The second CFC should always output the
current time. Unfortunately the time is not save in the application
scope. This indeed means a pointer.
Does someone now ways to do some CFC caching?
CFM Page
<cfapplication name="persistencyTest" sessionmanagement="yes"
clientmanagement="no">
<cfif NOT IsDefined('application.IOFactory')>
<cfset application.IOFactory =
createObject('component','myfunction')>
<cfset application.IOFactory.init()>
</cfif>
<cfoutput>#application.IOFactory.mymethod()#</cfoutput>
<cfset IOFactory = createObject('component','myfunction')>
<cfset application.IOFactory.init()>
<cfoutput>#IOFactory.myMethod()#</cfoutput>
MyFunction.cfc
<cfcomponent output="yes">
<cfset init()>
<cffunction name="init" access="public" returntype="date">
<cfset this.datetimestamp = Now()>
<cfreturn this.datetimestamp>
</cffunction>
<cffunction name="mymethod" access="public"
returntype="date">
<cfreturn this.datetimestamp>
</cffunction>
</cfcomponent>
Micha Schopman
Software Engineer
Modern Media, Databankweg 12 M, 3821 AL Amersfoort
Tel 033-4535377, Fax 033-4535388
KvK Amersfoort 39081679, Rabo 39.48.05.380
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
[Donations and Support]
- Caching CFC's Micha Schopman
- Re: Caching CFC's Raymond Camden
- Re: Caching CFC's Greg Stewart
- RE: Caching CFC's Micha Schopman
- Re: Caching CFC's Sean Corfield
- RE: Caching CFC's Hugo Ahlenius
- Re: Caching CFC's Raymond Camden
- RE: Caching CFC's Micha Schopman
- RE: Caching CFC's Micha Schopman
- Re: Caching CFC's Micha Schopman
- Re: Caching CFC's Raymond Camden
- Re: Caching CFC's Nick de Voil
- RE: Caching CFC's Micha Schopman
- RE: Caching CFC's Micha Schopman