I thought maybe to use the callback with tquery and then I can do 'cache_insert_id();'
Exactly. You can pass the position to the callback or fetch it in the callback itself. I don't think it really matters where you decide to fetch it as inserting a single new record happens almost instantly.