1

ColdFusion 8 正在缓存我的 cfcs。发展处于停滞状态。我无权访问管理面板。我有哪些选择?

4

3 回答 3

2

1) 访问 CF 管理员。

真的。我不想托管任何我无法控制的地方。

2) 以编程方式清除缓存。

使用管理 API:

createObject("component","cfide.adminapi.runtime").clearTrustedCache()

当然,如果您无权访问 CFAdmin,您可能也无权访问它,但值得一试。

根据Ray Camden 的这篇博客文章,在运行上述命令之前,您需要通过 API 登录到管理员,这当然表明如果没有访问权限,它就无法工作。

<cfset API = createObject("component","cfide.adminapi.runtime") />
<cfset API.login(adminPassword="password") />
<cfset API.clearTrustedCache() />
于 2012-12-14T17:18:18.847 回答
0

我使用 application.cfc 清除所有 cfc 缓存。

    <!--- *****************************************************************
      Run before the request is processed
      ************************************************************--->      
<cffunction name="onRequestStart" returnType="boolean" output="false">
    <cfargument name="thePage" type="string" required="true">
    <cfscript>
        if (structKeyExists(url,'reinit')) {
            structClear(application);
            structClear(session);
            onApplicationStart();
            onSessionStart();
        }
    </cfscript>
    <cfreturn true>
</cffunction>

这个想法是传递一个名为“reinit”的 url 变量。只要在 URL 中定义此变量,就会启动应用程序。

为了测试这一点: 1. 对 cfc 进行更改 2. 通过 xxx.cfm?reinit=1 调用 cfm 页面 3. 观察 cfc 中的更改是否得到反映。

希望能帮助到你...

于 2012-12-18T15:25:32.043 回答
0

I know that this post is old, but I needed to do this for a (more) modern version of ColdFusion (2016) and the answer from Peter wouldn't work on CF 2016. Not looking to be the answer, just a footnote for newer versions of CF.

Here is a version that will work with CF 2016:

<cfscript>
    variables['adminPW'] = "my cf admin password";

    cfAdminAPIAdmin = createObject("component", "cfide.adminapi.administrator");
    cfAdminAPIAdmin.login(variables.adminPW);

    cfAdminAPIRuntime = createObject("component", "cfide.adminapi.runtime");

    // clear the component and trusted (template) caches
    cfAdminAPIRuntime.clearComponentCache();
    cfAdminAPIRuntime.clearTrustedCache();
</cfscript>

Adobe appears to have separated the CF admin functionality from the runtime component. That's really the only difference. The version above shows how to clear the component cache too.

NOTE: I had been doing something very similar to CFNinja's answer, but one site (out of about 25 similar sites) just wouldn't clear the application scope components, the old version remained in a cache somehow.

于 2020-02-13T00:05:57.600 回答