How can I write a custom smoke cache?
Since 2.77 Blender can use the OpenVDB format for smoke caching, and OpenVDB has a nice API and documentation. (There is also a Python API)

It is also an industry standard, which will be better supported in Blender in the future.