ColdFusion 服务器 CFC 缓存问题

发布于 2024-08-21 09:29:39 字数 331 浏览 4 评论 0原文

我在笔记本电脑上使用其自己的 ColdFusion 8 服务器和 IIS(在 Windows Vista 上运行)开发 ColdFusion 应用程序。我有一个相当烦人的问题。

问题是每当我对 CFC 进行任何更改时,除非重新启动 ColdFusion 应用程序服务器,否则对 CFC 的更改将不会生效。很多时候,我必须重新启动整个计算机,因为 Windows 无法重新启动 ColdFusion Application Server 服务。有没有更好的方法来重置 ColdFusion 服务器的 cfc 缓存?

这开始占用大量时间,只是在我做出更改后必须经常重新启动。任何见解将不胜感激!

谢谢你!

I develop coldFusion applications on my laptop with it's own ColdFusion 8 server with IIS which run on Windows Vista. I am having a rather annoying problem.

The problem is whenever I make any changes to my CFC's, it appears that unless I restart my ColdFusion Application server, the changes to my CFC's will not take effect unti I do so. Often times, I have to restart my whole machine because Windows can't restart the ColdFusion Application Server service. Is there a better way to reset the ColdFusion Server's cfc cache?

This is beginning to suck up a lot of time just having to restart every so often after I make a change. Any insight would be greatly appreciated!

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

山人契 2024-08-28 09:29:39

我保证您将它们创建为某种持久范围内的对象,例如:应用程序、会话范围。在开发过程中,为避免此问题,我通常会创建一个 url 参数,并在 application.cfm/cfc 文件(或创建对象的任何位置)中检查该参数,如果检测到该 url 参数,则重新创建对象。

示例:

<cfif NOT structKeyExists(application,"myObj") OR structKeyExists(url,"reinit")>
    <cfset application.myObj = createObject("component","path.to.cfc") />
</cfif>

当然,您需要对遇到问题的每个对象执行此操作。

I guarantee you are creating these as objects in some sort of persistent scope, eg: application, session scopes. What I generally do to avoid this problem during development is create a url parameter and check for that in the application.cfm/cfc file (or wherever you are creating the objects) and recreate the objects if that url parameter is detected.

Example:

<cfif NOT structKeyExists(application,"myObj") OR structKeyExists(url,"reinit")>
    <cfset application.myObj = createObject("component","path.to.cfc") />
</cfif>

of course you would need to do this with every object that you are having a problem with.

冷心人i 2024-08-28 09:29:39

我不确定这是否在其他版本的 CF 中也存在,但在 CF9 中你可以执行 ApplicationStop() ,它将重置 CFApplication 并重新加载它。

im not sure if this is in other versions of CF also but in CF9 you can do ApplicationStop() and it will reset the CFApplication and reload it.

棒棒糖 2024-08-28 09:29:39

在 CFAdmin 中取消选中“组件缓存”-->缓存

另请检查 CFAdmin -->映射并确保 CFC 文件夹指向正确的文件夹(如果有)。有时,人们会克隆源代码,但不会更改到新文件夹的映射。

Uncheck "Component cache" in CFAdmin --> Caching

Also check CFAdmin --> Mappings and make sure the CFC folder is pointing to the right one if any. Sometimes people clone their source code and don't change the mapping to the new folder.

滿滿的愛 2024-08-28 09:29:39

在您的 Coldfusion Administrator 中,您是否启用(选中)以下任一选项?

缓存>可信缓存

缓存>保存类文件

In your Coldfusion Administrator, do you have either of the following enabled (checked)?

Caching > Trusted Cache

Caching > Save class files

懷念過去 2024-08-28 09:29:39

只是问显而易见的问题:
您是从 onApplicationStart 调用这些函数吗?

Just asking the obvious:
Are you calling these functions from onApplicationStart?

温馨耳语 2024-08-28 09:29:39

也许可以尝试 CF 管理 > 下的“清除模板缓存”按钮缓存。

我以前也遇到过这种情况。我通常需要点击几次按钮才能让 CF 注册更改的文件。

也可以尝试取消选中“缓存”下的所有内容。注意:仅对开发机器执行此操作!

Maybe try the "Clear template cache" button under CF Admin > Caching.

This has happened to me before. I usually have to click the button several times for CF register the changed files.

Might also try unchecking everything under Caching as well. Note: Only do this for development machines!!!

浪菊怪哟 2024-08-28 09:29:39

如果您必须在开发中进行缓存,您可以执行我所做的操作:

首先在 onRequest() 方法的顶部检查 URL 标志,该方法将调用 onApplicationStart() 方法:

<cfif IsDefined("URL.dev")>
    <cflock timeout="5" scope="Session" type="Exclusive">
        <cfif URL.dev EQ true>
            <cfset SESSION.debug = true />
        <cfelse>
            <cfset StructDelete(SESSION, "debug") />
        </cfif> 
    </cflock>
</cfif>

<cflock timeout="5" scope="Session" type="Readonly">
    <cfif IsDefined("URL.appreset") or IsDefined("SESSION.dev")>
            <cfset StructClear(SESSION) />
            <cfset onApplicationStart() />
        </cfif>
</cflock>   

这将解决您的大部分问题。但是,如果正在加载的类出现问题,则无法检查此标志。我为此使用的解决方案:

将以下内容添加到 onError() 方法的底部:

<cfif IsDefined("APPLICATION")>
      <cfset StructClear(APPLICATION) />
</cfif>

最后,您要检查 APPLICATION 对象是否存在,以及您声明为 APPLICATION 范围一部分的每个类是否存在或您想要调用onApplicationStart()。为此,请在 onRequestStart() 顶部的第一个代码块的正下方添加以下内容:

<cfif not IsDefined("APPLICATION")
    OR not StructKeyExists(APPLICATION, "[ClassName1]")
    OR not StructKeyExists(APPLICATION, "[ClassName2]")
    ...>
    <cfset onApplicationStart() />
</cfif>

If you must have caching in dev, you might do what I do:

First put a check for a URL flag to the top of your onRequest() method which will call the onApplicationStart() method:

<cfif IsDefined("URL.dev")>
    <cflock timeout="5" scope="Session" type="Exclusive">
        <cfif URL.dev EQ true>
            <cfset SESSION.debug = true />
        <cfelse>
            <cfset StructDelete(SESSION, "debug") />
        </cfif> 
    </cflock>
</cfif>

<cflock timeout="5" scope="Session" type="Readonly">
    <cfif IsDefined("URL.appreset") or IsDefined("SESSION.dev")>
            <cfset StructClear(SESSION) />
            <cfset onApplicationStart() />
        </cfif>
</cflock>   

This will fix most of your problems. However, if you have a problem in a class that you are loading, it won't get far enough to check for this flag. The solution I use for this:

Add the following to the bottome of your onError() method:

<cfif IsDefined("APPLICATION")>
      <cfset StructClear(APPLICATION) />
</cfif>

Finally, you want to check that the APPLICATION object exists and that each class you are declaring as part of the APPLICATION scope exists or you want to recall onApplicationStart(). To do this, add the following right below the first block of code at the top of onRequestStart():

<cfif not IsDefined("APPLICATION")
    OR not StructKeyExists(APPLICATION, "[ClassName1]")
    OR not StructKeyExists(APPLICATION, "[ClassName2]")
    ...>
    <cfset onApplicationStart() />
</cfif>
假装不在乎 2024-08-28 09:29:39

我遇到了完全相同的问题,有时如果启动服务器服务管理器后更改没有反映,我必须重新启动计算机。

我所做的是,在(管理员,缓存)中:
1.我取消选中所有缓存选项
2.我将文本框值设置为“0”
3.我在开发时保持(管理员,缓存)页面打开,这样当我上传更改并且它没有反映时,我只需点击“立即清除模板缓存”。

这就是我在 CF8、内置 Web 服务器、XP 上的工作原理。

I had the exact same problem, sometimes I had to restart the machine if the changes would not reflect after starting the server the service manager.

What I do is, in (Administrator,Caching):
1. I unchecked all cache options
2. I set the text box values to "0"
3. I Keep the (Administrator,Caching) page open when developing, so that when I upload a change and it doesn't reflect, I just hit the "Clear Template Cache Now".

This is what is working for me on CF8, Built In Web Server, XP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文