Cache key generation mismatch?

I was wrestling with view caching today and ran into something of interest I wanted to get a second set of eyes on.

Using the clearView() method on my cache provider (FYI it’s RailoColdBoxProvider) wasn’t clearing my views from the cache. Upon inspection, it’s because there was a colon in the cache key name as set by the renderer but the element cleaner wasn’t adding this same colon to the mix when looking for the key to clear. I just checked the master GitHub branch to see if it’s still there and it is:

Here’s where Renderer generates the cached view key (note the colon that is concatenated in there):
https://github.com/ColdBox/coldbox-platform/blob/master/system/plugins/Renderer.cfc#L151

Here’s where the element cleaner builds the key to attempt to match and clear from the cache (note the absence of the colon):

After adding some debug output into the cleaner, I saw it looking for a key like this:

railo_view-home/loggedInView

But saw that the cached view was in there under this key:
RAILO_VIEW-:HOME/LOGGEDINVIEW

It seems like it’s not able to clear due to the colon not being in the sought-after key generated by ElementCleaner. I’ve added the colon locally and everything works well. Am I missing something? Or if this is a bug, what’s the best way to get this in the right place so it can be solved in a later release?

Thanks,
Adam

Good catch, I was just looking for this myself. Yes make a pull request or raise a ticket, it will be fixed fast. Luis is good like that.

Issue filed: [COLDBOX-278] View cache clearing ineffective; should use same key name as view cache storing - Welcome

I considered a pull request, however I think there are additional considerations that might go into this, I think clearViewMulti() might be suffering in kind here as well. I added that note to the issue - I’m afraid I haven’t tested clearViewMulti() enough to post precise findings. Please let me know if I’ve missed anything important with the issue documentation, I’m happy to make any adjustments necessary.

Thanks for the quick response, Andrew!

  • Adam