In a java program, I have a requirement of temporarily storing many records- one record consists of a key, a object as well as an integer value. The total processing will be for millions of records, but I plan to delete one record after processing has been completed on it... After that another record is inserted, processing is done on it, then it is deleted.... and so on...
What is the best way of storing such values with the help of memory mapped IO?
I can see samples for mapping byte buffers, but how do I store multiple records, and then retrieve them... Do I have to store the position numbers as I add records to the file storage, and use these to retrieve the data? Then I will have to create another array to store position numbers... Is there any recommended way of storing/retrieving data using memory mapped IO in java?
Maybe this is what you are looking for: