Use the server hostname to get the prefix.

It is more reliable than the zone.
Add logging when the redis cache has a hit.
Split the functions, add initial support for rate limiting.