Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Tested in CF7, CF8, and CF9

Excerpt

You can improve (production) performance by turning on trusted cache for your ColdFusion server. However, it's easy to forget that trusted cache is on when you do an update. Here is how to add this functionality to the FarCry Webtop so you can flush cache when you re-initialise the application (only tested in CF8)..

Tip
titleTested in CF7, CF8, and CF9

Code Block
title(project or plugin)\packages\forms\UpdateApp.cfc
<cfcomponent displayname="Update App" 
             hint="Provides a granular way to update parts of the application state"
             extends="farcry.core.packages.forms.UpdateApp" 
             output="false">
       
    <cfproperty ftSeq="101" 
                ftFieldset="ColdFusion" 
                name="cfCache" 
                type="boolean" 
                default="0" 
                hint="Flush ColdFusion Trusted cache" 
                ftLabel="Flush Trusted Cache" ftType="boolean" />

    <cffunction name="processCFcache" 
                access="public" returntype="boolean" 
                description="Reload PSL Service" 
                output="false">

        <cfset var adminObjoCFAdmin = createObject("component","cfide.adminapi.administrator").login(application.fapi.getConfig('coldfusion','password')) />
        <cfset var oRuntime = createObject("component","cfide.adminapi.runtime") />

        <!--- Clear trusted cache --->
        <cfset oRuntime.clearTrustedCache() />
        <!--- Stop and restart trusted cache --->
        <cfset oRuntime.CLEARTRUSTEDCACHE(setCacheProperty("TrustedCache", 0) />
        <cfset oRuntime.setCacheProperty("TrustedCache", 1) />

        <cfreturn true />
    </cffunction>

</cfcomponent>
Code Block
title(project or plugin)\packages\forms\configColdFusion.cfc
<cfcomponent extends="farcry.core.packages.forms.forms"  
             key="coldfusion" 
             displayname="ColdFusion Config" 
             hint="ColdFusion Server" 
             output="false">
    <cfproperty ftSeq="1"
                name="password" 
                type="string" 
                default="" 
                hint="Password for accessing CF Admin API"
                 ftSeq="1ftHint="Password to allow FarCry access to the CF admin API" 
                ftFieldset="Server" 
                ftLabel="CF Password" 
                ftType="password" 
                ftRenderType="editpassword" 
                ftstyle="width:500px;" />
</cfcomponent>