cache: add a function to read an object ID from a buffer