For high-speed scenarios where you only need to check if the id exists and don’t need the full object, storing just the id in a separate cache is usually better. It makes checking faster.
If memory is not a big concern and you want to keep things simple, you can stick with storing everything in the same cache, but it will be slower.
So, in most cases with a high-throughput flow, create a separate cache for just the id. This will make the system faster because you only need to read the small id data instead of the whole object.