@fmstrat I must admit I don’t know the answer to the original question you’ve asked (should have mentioned that earlier too, I know)
I agree that direct DB access is more efficient than API. Still seems pretty dangerous though, the table structure could “suddenly” change and cause the data to be corrupted (seems not very likely, but I don’t think Plex devs wouldn’t give any heads up before doing so) and then there are those write conflicts (?) when you and Plex server use the DB at the same time. Maybe it’s not even cache, it might just hold the data in memory for some time during library scanning or something, and write something back based on a state that’s no longer true. Are you able to take DB snapshots, like every second or so? Maybe you could figure out what causes the conflicts based on the differences in snapshots when the corruption occurs… this seems like a long shot though.