Ensure cache key is valid.