Why is my property, listener, filter or plugin being cached by CF9 wrongly?
With some of the caching changes made in CF9 you can see some 'bleed' over from other apps on your server if you use generic names for your mappings. For example, here is a snippet from a mach-ii.xml file:
<properties> <property name="applicationRoot" value="/" /> <property name="defaultEvent" value="publicHome" /> <property name="eventParameter" value="event" /> <property name="parameterPrecedence" value="form" /> <property name="maxEvents" value="10" /> <property name="exceptionEvent" value="exception" /> <!-- Application properties formerly placed in the Application.cfc --> <!-- Self awareness properties i.e. upload folder, location on the server etc. --> <property name="applicationProperty" type="properties.applicationProperty" /> <property name="sessionProperty" type="properties.SessionProperty" /> </properties>
Notice that the applicationProperty & sessionProperty are using generic mappings to the properties folder. CF9 seems to have changed the way it computes the hash for their cache key for CFCs. This can cause the server to get confused about which CFC you are asking for. One simple solution is to create an app specific mapping in your Application.cfc and use the mapping for your unique CFC paths.
<cfcomponent displayname="MyApplication" extends="MachII.mach-ii"> <cfset this.loginStorage = "session" /> <cfset this.sessionManagement = true /> <cfset this.setClientCookies = true /> <cfset this.setDomainCookies = false /> <cfset this.sessionTimeOut = CreateTimeSpan(0,0,30,0) /> <cfset this.mappings["/MyApplication"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) /> ..... </cfcomponent>
Once you have accomplished this go back into your mach-ii config file and add 'MyApplication?' to the dot notation for your property and listener declarations, like so:
<properties> ... <!-- Application properties formerly placed in the Application.cfc --> <!-- Self awareness properties i.e. upload folder, location on the server etc. --> <property name="applicationProperty" type="MyApplication.properties.applicationProperty" /> <property name="sessionProperty" type="MyApplication.properties.SessionProperty" /> </properties> <!-- LISTENERS --> <listeners> ... <listener name="actionLogListener" type="MyApplication.model.actionLog.actionLogListener" /> <listener name="newsListener" type="MyApplication.model.news.newsListener" /> ... </listeners>
