Recommended way to store a Map<String, CustomObject> as bin

What is the recommended and performant way to store a Map<String, CustomObject> as bin in Aerospike? I need to perform following operations on the bin

  • Fetch the entire map from the record (i.e., fetch the entire bin)
  • update/insert single key into the map.

With the latest java-client update of removing BlobValue Serialization, this needs custom handling at clients.

There seems to be 3 ways to do this

  1. Serialize/deserialize CustomObject to byte[] (and vice versa) and store as map. single key updates using client.operate
  2. Serialize/deserialize CustomObject to Map<?, ?> and store as map in aerospike. single key updates using client.operate
  3. Use AerospikeMapper, store as map and do single key updates using VirtualList.

1 & 2 requires Serialization/Deserialization code at Client.

// class for java client
public class Document {
  private String key;

  private Map<String, CustomObject> binMap;
}

// class for java mapper
@AerospikeRecord (namespace = "test", set = "custom")
public class Document {
  @AerospikeKey
  private String key;

  @AerospikeEmbed(type = EmbedType.MAP, elementType = EmbedType.LIST) // elementType as List for storage efficiency
  private Map<String, CustomObject> binMap;
}