Optimizing whitelist by caching