Improve hash prefix with internal cache, add ttl comment