Template cache eventSnippets don't match module events or event suffixes

Description

I have a Coldbox event lookupUser that takes a username argument and returns a user memento. It lives a module called public that is a child module of our API module in a handler called authenticate.

According to this page:

https://coldbox.ortusbooks.com/the-basics/event-handlers/event-caching

I should be able to do this:

And it should clear any event whose name matches "User". It doesn't, unless I specify the entire event path:

If I remove public or authenticate, it won't clear that event from the cache.

If I try to leverage the EVENT_CACHE_SUFFIX value on the authenticate handler, e.g.

And then do this:

It will also not clear the event cache for that event.

Activity

Show:
Samuel W. Knowlton
August 20, 2020, 4:05 PM

The event snippet matching works, but event suffixes and queryString matching do not seem to.

Updated test results: I ran a cached event two ways – one using eventArguments and one using rc variables, e.g.

Test 1: using rc and the full query string to clear an individual event whose snippet matches module:handler.event: failed; query string not matched

Same test repeated with queryString='sam@inleague.org': failed

Test 2: Using eventArguments instead of rc to specify username: failed any form queryString matching

Test 3: Not using the full module path and just using the event snippet: passed with no queryString matching; failed to match queryString or eventArguments

Test 4: Replace event name snippet with EVENT_SUFFIX, e.g. in the authenticate handler, add:

Result: failed - there is no indication in the template cache that userCache shows up anywhere, and trying to purge the cache based on userCache does not do anything.

Samuel W. Knowlton
7 days ago

Can we buy perhaps an hour of your time to get into this? We’d really like this caching strategy to work but it’s not really close at the moment, both between event caches triggering even when the RC scope is different and the inability to clear a cache based on either eventArguments or event suffixes.

I’d like to get a sense of what is required to make this do what we want it to do and if it’s not a super tall order, we are happy to sponsor it.

Luis Majano
6 days ago

Thanks . Event caching is one of the hardest things to replicate and create test cases around. We have through time added tons of strategies around it, but permutations can be endless. Therefore, it requires just time to analyze and go through test cases. I think the best way to tackle this for me, would be if you could give me a standalone app test case. This way, I would incorporate it into the test harness and go through the stories around it.

Samuel W. Knowlton
6 days ago

OK. I think I can put something together with the REST handler and a couple test cases. I will think about how to do this - do you want me to post it here or on a new ticket?

Luis Majano
6 days ago

Here is fine.

Assignee

Luis Majano

Reporter

Samuel W. Knowlton

Labels

None

Fix versions

Affects versions

Priority

Major
Configure