I had this problem before with really long simulations, when it's impossible to have all cached in scene even with 128 gigs of ram. So i had to export zCache.
How i usually work with short sims, is that i cache in scene, than export alembics from scene when it's all cached.
Problem with longer scenes, is that you cant have all cached in ram. It crashes maya.
So than i had two choices:
1. To export alembic on sim time without zcaches for later debugging if something gets funky in simulation.
2. export zcache without alembic, but than i need to manually load back zcache files and rebuild individual frames.
What i ended up with, i used script similar as Andy's for exporting zcache files to hard disk, but i wrote it as script to be called as per Frame Callback in alembic export.
That way i managed to have exported alembic meshes on sim time, but have my zCache files exported per frame in case i need it later to inspect if something is funky in simulation. So when i start alembic export on geo i want, it will go and simulate, but on every frame, alembic will call script to export zCache files and empty ram for next frame.
That's how i managed to have long simulations, and export alembic and zcache in same time.
If there is another way to do it, let me know ๐
Cheers,
V