开发者

How do I reset application.cfc without resetting the server instance? [duplicate]

开发者 https://www.devze.com 2022-12-14 03:52 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: restart a开发者_如何学编程pplication without restarting server?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

restart a开发者_如何学编程pplication without restarting server?

How do I reset a Coldfusion Application / application.cfc without resetting the Coldfusion Server instance? If I remember right, there are a few tricks out there such as creating a reinit function within application.cfc or renaming the file.


A couple of steps:

First, make sure all your application initialization logic is contained inside the OnApplicationStart method of your CFC. If it has nested calls, that is fine - just so long as you can re-initialize your application easily through a single call makes your life much easier.

Second, this is the code I use in the OnRequestStart method of application.cfc

<cfif structKeyExists(url,'resetappvars')>
  <cfset OnApplicationStart() />
</cfif>

Feel free to use whatever coded value you would like in place of resetAppVars.


CF9 Doc:

To restart the application, you can stop the application using ApplicationStop() and the next request to any page in this application automatically starts it.

ApplicationStop() is new in ColdFusion 9.


If you're on CF8 and using the "if reinit, then call onApplicationStart()" approach, make sure you avoid race conditions. This is a good explanation: http://blog.bullamakanka.net/2009/12/coldfusion-shared-scopes-and-race.html

0

精彩评论

暂无评论...
验证码 换一张
取 消