It’s all in the code. The cache service connects to about 850 different relays, pulls events, de-dupes them, and then does some basic aggregation to make the data more useful.
It’s one piece of the puzzle that is building really high performance clients.