Details
Assignee
Michael OffnerMichael OffnerReporter
Alexander KwaschnyAlexander KwaschnyNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Priority
Major
Details
Details
Assignee
Michael Offner
Michael OffnerReporter
Alexander Kwaschny
Alexander KwaschnyNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Priority
Created 27 September 2015 at 23:02
Updated 19 December 2016 at 14:29
I found the reason for the incompatibility. Cache regions created in the admin server context is always shared among all applications while cache regions in the admin web context is exclusive to the corresponding application.
Although the way it works is consequent due to the major differences in caching between ACF and Lucee, it will still break applications moving from ACF to Lucee. And to be honest, it's quite a hassle if you have to create the default cache for every single application.
The cache functions
cacheGet
andcachePut
(and the correspondingcfcache
tags) work differently in Lucee and ACF when omitting theregion
(cacheName
). Omitting the region will use the default Object Cache according to the documentation.In Lucee, the default Object Cache is a global (instance wide) container for all objects of any application in the same instance. Thus the keys are shared between multiple applications. This behavior holds true for both caching types: EHCache and RamCache.
In ACF, the default Object Cache is a local (application bound) container for objects placed in the context of the application only. Thus the keys are not shared between multiple applications.
The following example demonstrates the difference:
/appA/Application.cfc
component { this.name = 'AppA'; }
/appB/Application.cfc
component { this.name = 'AppB'; }
/appA/index.cfm
and/appB/index.cfm
<cfscript> cachedVar = cacheGet("test"); if (isNull(cachedVar)) { cachedVar = APPLICATION.ApplicationName; cachePut("test", cachedVar); } writeOutput(cachedVar); </cfscript>
Output in Lucee (starting with a request of
/appA/index.cfm
):Output in ACF (starting with a request of
/appA/index.cfm
):The function
cacheGetAllIDs()
follows the same rules. In Lucee, it will return the keys of all applications. In ACF, it will return the keys of the current application only.