Shared cache and timers

I’m experimenting with timers and shared cache to store the timer object.
What I noticed, is that the object in the shared cache is deleted each time the rule is saved. I guess saving the rule unloads it so according to the docs the cache is cleared as no other rule has accessed the key. The docs also say that timers in the key are canceled, but that does not seem to happen.
Here is my test rule:

console.loggerName = 'org.openhab.test_rule';
var timer_var = cache.shared.get('timer_var', () => ({}));

var callScriptGenerator = function(data) {
  return function() {
    console.info(data);
  }
}

if ('timer' in timer_var) {
  console.info("timer already set")
} else {
  console.info("setting timer")
  timer_var['timer'] = actions.ScriptExecution.createTimer(time.ZonedDateTime.now().plusSeconds(10), callScriptGenerator("This is a test"));
}

I executed it three times and saved the rule between execution 2 and 3. This is what I see in the log:

2023-12-05 21:20:54.338 [INFO ] [org.openhab.test_rule               ] - setting timer
2023-12-05 21:20:57.277 [INFO ] [org.openhab.test_rule               ] - timer already set
2023-12-05 21:21:02.783 [INFO ] [org.openhab.test_rule               ] - setting timer
2023-12-05 21:21:04.339 [INFO ] [org.openhab.test_rule               ] - This is a test
2023-12-05 21:21:12.785 [INFO ] [org.openhab.test_rule               ] - This is a test

So both timers trigger even if the key is cleared from the cache in between. Is this a bug, is the documentation wrong or did I misunderstand something?