This cache is going in a completely wrong way. We already generates lots of vertex formats and cache them internally. So just move this if statement into the initialization.
Please also look at the OGL backend as we generates the VAO in initialization there.