Search code examples
javascalacassandratimeuuid

How to generate TimeUUID in Java/Scala


Does anyone know how to generate TimeBased UUIDs in Java/Scala?

Here is the column family:

CREATE table col(ts timeuuid)

I'm using Cassandra 1.2.4

Appreciate your help!


Solution

  • Cassandra has UUIDGen for generating Timeuuids. The source for this is here:

    https://github.com/apache/cassandra/blob/cassandra-2.1/src/java/org/apache/cassandra/utils/UUIDGen.java