Best way to get previous Map data if put operation replaces existing data


I want to get the previous value from the map at a given map key when doing a put operation. I could do a read first, but the extra network roundtrip overhead and the underlying cost of the server reading the map twice (one for each of these operations) is undesirable. I there a best practice for this scenario? Is there another way of accomplishing this other than a read before write? I was hoping I could send both Operations as a batch, but the documentation indicates that the read would happen AFTER the write, and I want it to happen BEFORE the write.

I’d love to be able to pass a MapReturnType to the put operation to indicate that I want the old data returned.

Any suggestions?


The server changed operation order from “write before read” to “in operation order” years ago. Can you point to the documentation which hasn’t been updated to reflect this?


You’re right, of course. I see it plainly stated on

This statement toward the top confused me.
Aerospike provides the ability to perform multiple operations on a record within a single transaction. This feature allows modification of record bins, and then reads them back to the client within a single transaction. The application gets record status at transaction completion.

I should have read further.

Thanks for clarifying.