A more robust strategy would be at least be to check if the rule was the same as the previous one (or a small hash table) so that the system is self-healing.
Ken’s solution is at least robust and by that property I would prefer it since it’s just as fast but doesn’t have any weird tail latencies where the requests out of your cache distribution are as fast as the ones in.
Also, it's trivial to keep Ken's implementation as the slow path. If request patterns change, dig up the new fast path and put the old one in Ken's slow path code. Most of the performance will still come from the initial `if`.
6 months ago, "what temp is pork safe at?" was a few clicks, long SEO optimised blog post answers and usually all in F not C ... despite Google knowing location ... I used it as an example at the time of 'how hard can this be?'
First sentance of Google AI response right now: "Pork is safe to eat when cooked to an internal temperature of 145°F (63°C)"