Apart from executing events from the URL/FORM or Remote interfaces, you can also execute events internally, either public or private from within your event handlers or from interceptors, other handlers, layouts or views.
You do this by using the runEvent()
method which is inherited from our FrameworkSuperType
class. Here is the method signature:
The interesting aspect of internal executions is that all the same rules apply, so your handlers can return content like widgets, views, or even data. Also, the eventArguments enables you to pass arguments to the method just like method calls:
As you can see from the function signature you can tell ColdBox to cache the result of the event call. All of the cached content will go into the template cache by default unless you use the cacheProvider
argument. The cache keys are also based on the name of the event and the signature of the eventArguments
structure. Meaning, the framework can cache multiple permutations of the same event call as long as the eventArguments
are different.
Tip: You can disable event caching by using the coldbox.eventCaching
directive in your config/ColdBox.cfc