Event Caching and this.EVENT_CACHE_SUFFIX (cb 2.6.4)

I am attempting to make event caching work. I have the basics down and
am receiving accurate results based upon URL variables.

The issue I have ran into is affecting the cache based upon non URL
variables. Basically, I have certain environment variables I need to
use to determine which cached version to use. So reading the
documentation I found the public variable this.EVENT_CACHE_SUFFIX.
However, no matter how I attempt to set this value it doesn't seem to
get set beyond the first event request. Reviewing the /system code
indicates setting this on the Handler is the appropriate location.

Things I have tried in my handler. None of these seem to work (short
hand is intentional):

<cfomponent name="myhandler">
this.EVENT_CACHE_SUFFIX = [some string of values];
......

<cfomponent name="myhandler">
  <cffunction name="prehandler">
      this.EVENT_CACHE_SUFFIX = [some string of values];
  </cffunction>
......

<cfomponent name="myhandler">
  <cffunction name="[event being called]">
     this.EVENT_CACHE_SUFFIX = [some string of values];
  </cffunction>

I do have significant experience with ColdBox ( 2 yrs ). This one has
me baffled.

Thanks in advance for your assistance.

No problem, this is somethign that we want to address in 3.0 or later, which is to add a dependsON or something to the event caching. However, as of now, a workaround is actually to use the event cache suffix, BUT you must set the caching metadata on THAT specific handler to OFF. Thus, making the handler a transient for event caching purposes.

That cache=false, will then make the event_cache_suffix dynamic and thus you can leverage it for event caching dynamically.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Luis,

Thanks for you quick response. Unfortunately, this does not create the
desired result.

<cfcomponent name="catalog" output="false" cache="false">
     <cfset this.EVENT_CACHE_SUFFIX = _initCacheSuffix() >

    <cffunction name="productList" cache="true" cacheTimeout="10">

    </cffunction>
</cfcomponent>

The _initCacheSuffix method is creating strings that look like these:
S16C423P1WBOSST312_FeatureList2056 ,
S16C423P1WBOSST312_FeatureList1765_1765BrandNameListATTParentCategoryNameOrderByPriceHigh,
S16C423P1WBOSST312_FeatureList58BrandNameListParentCategoryNameOrderByPriceLow

However, the suffix is being ignored entirely. Even with the component
meta data cache set to false.

I went so far as to turn Handler caching off entirely for my dev
environment:
<Setting name="EventCaching" value="true" />
<Setting name="HandlerCaching" value="false" />
<Setting name="HandlersIndexAutoReload" value="true" />

I created a preprocess interceptor that adds a key to the URL struct
and was able to overcome this for the time being.

This is obviously a hack as it is not a good practice to modify the
URL struct directly, but it will get us to production until I can
figure out how to make the event cache suffix work.

Thank you for your help.

did you try in coldbox 3?
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com