Hi,

It calls the function, but it doesn�t hit the file, because the SERVER scope
is persistent until the server is shut down.
When it tries
<cfif NOT structKeyExists(server,"myCFCConfig")>
the second time, this will returns TRUE for structKeyExists, even if you
leave your app, close your browser or timeout your Application or session.
The only way to get rid of the SERVER keys is to implicit destroy it
    (StructDelete(SERVER , "myCFCConfig")

But yes, you can always cache your component and test outside your method
call, as:
<cfif NOT structKeyExists(server,"myCFCConfig")>
    (CALL METHOD INIT)
</cfif>

[]s

Marcantonio da Silva
Diretor de Desenvolvimento de Produtos
[EMAIL PROTECTED]
Navita - http://www.navita.com.br
55 (11) 3365-2173  - (11) 9656-4634
----- Original Message -----
From: "Bryan F. Hogan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 16, 2003 5:55 PM
Subject: RE: [CFCDev] Initialize only once


> The below works. What if I cache the component itself in the application
scope outside of the CFC would that keep it from
> reading from the config file everytime? So far it seems that even if the
component is cached it still calls the init function
> everytime.
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Nathan Dintenfass
> Sent: Thursday, October 16, 2003 11:28 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] Initialize only once
>
>
> Well, at some point you'll need to put something in a persistent memory
> scope if you want it to stick around from request to request (assuming you
> don't want to read it off the file system/network every time).  My initial
> suggestion about the server scope was, in fact, to use it internal to the
> CFC.  So, something like:
>
> <cffunction name="init">
> <cfif NOT structKeyExists(server,"myCFCConfig")>
> DO CONFIG
> </cfif>
> <cfset variables.config = server.myCFCConfig>
> </cffunction>
>
> Again, this is not really a best practice, but if you really want it to be
> "inside" your CFC you'll need to do something along those lines.
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.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 word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to