Its an internal counter that Aerospike increments every time you update a record. You cannot change the value of the counter. It rolls over back to zero after 64K. Aerospike keeps track of the rollover. It is used to accomplish read - modify - write between two separate locks on the record. In the read operation, which is under a single record lock, besides reading the data, you also read the generation value. In the write operation, which is another, but separate record lock, you send the update you want to make and the previously read generation value and use write policy GEN_EQUAL which tells Aerospike - make the update to the record only if the generation value is ‘this’ … whatever you passed. If someone modified the record between your read and write, your write will not succeed in this case and you can retry the read-modify-write. It is also called “Check and Set” functionality. It is useful in modeling some problems and is required because Aerospike has record level locks, for both read and write operations. There are two other possible alternatives, depending on use case, to using this method (GEN_EQ)… one is via Operate() and the other is using Record UDFs (User defined functions).
*Gen counter is not updated if you just read a record