First of all, Coldbox event caching is awesome. The ability to cache the output of an entire event can make a Coldbox app extremely fast. However, one caveat/tradeoff of event caching is that Coldbox uses the
rc scope to determine the cache key, instead of the event name. This gives users the flexibility to create different event caches for pages like:
While this is beneficial for pages that utilize
rc scope to display different output, it does make it difficult to cache pages if you do not want the
rc scope to influence whether a cached copy of an event should be returned or not.
For example, let’s say you cache the home page of your app to make sure it loads extremely fast. You may not be able to control whether site visitors access the home page through a “pure” URL with no parameters. If the visitor arrived by clicking a link from an email marketing campaign, there might be a series of tracking variables like
?utm_source appended to the URL. Depending on the situation, you could have every site visitor create a new cached copy of the event. Additionally, a malicious user could hit a page with an infinite number of URL variables which would create new cached instances of the output on every request.
Is there a way to tell Coldbox to cache an event and ignore the
rc scope? If not, this might be a valuable feature, especially for static pages like a home page or marketing landing pages.