[coldbox-3.5 and 3.1] clear cache, run external model in one site from another

We have 2 sites on the same server. The main, front-facing site uses
CB 3.5 BETA and the Admin portion of this site is running on CB 3.1.

We have several queries, views, etc. cached in the main site using the
Coldbox cache and we'd like to be able to announce an interception
point so that when certain things are updated on the Admin site, the
caches are cleared and some of the models are run and can re-cache on
the main site.

For example the main menuing system is dynamically created from the db
and then cached upon appInit. When we make updates on the Admin side
(e.g. add, delete or modify a product) we want to be able to have the
main sites menu cache cleared and the model method(s) run to
regenerate and then re-cache the menu.

My assumption is to have the main site's models accessible to the
admin site via model ExternalLocation and/or ScanLocations (has this
officially replaced the models external locations setting?) and/or a
direct mapping in my Wirebox binder but I cannot seem inject/run the
main sites models?

I can provide more details but I fear this question is a bit too
verbose already!


Hello Andy,

Yes! You can do this. I implemented a similar feature; however, I took a different path.

I create my own cache key names. The Admin application sends a HTTP request to the front-end application requesting an eviction. I have a secured handler that accepts a cache name and the key to evict. When an event occurs that requires instant cache eviction the HTTP message is dispatched, the front-end application evicts the item from the cache and all is swell.

The only important design consideration is you can’t (currently) evict Events from the ColdBox template cache in such a manner because we do not control the cache key for these cached items. Anything you set into the template cache–or a custom cache–can be solved with this recommendation with very little work.

Please keep us updated as to your progress.


Aaron Greenlee

Aaron - you rock! Such a simple solution - thank you!