That code is part of a commit from two weeks ago, after 3.4 was released. The private and shared cache variables may not be available for Rules DSL until OH 4. Or it might be possible that it’s only available in UI rules. You don’t really need it in text based rules, just declare a variable outside the rule at the top of the .rules file.
You don’t need to. Create a Map.
val timers = createHashmap
It has the same put
and get
methods that the privateCache
uses (since it’s a Map that backs that as well).