CUID generator for Perl 6.
Once CPU power and host machines are increased, UUIDs become prone
to collisions. To avoid such collisions, developers often resort to
database round trips just to check/detect a possible collision, and
thus, perform a new ID generation which doesn't collide. But nowadays,
databases are the major software bottleneck of our services, and that
round trips are too expensive (we lost scalability a lot)!
CUIDs are a solution for that sort of problem. Due the monotonically
increasing nature, we can also leverage that to improve database performance
(most specifically, dealing with primary keys). CUIDs contain host machine
fingerprints to avoid ID collision among the network nodes, and they could even work
generating CUIDs offline without any problem.
For more information, see: http://usecuid.org
This library is thread-safe regarding internal state counter.
Inside this root directory project, just type:
$ zef --force install .
As an alternative, you could type as well:
$ make install
To generate full CUIDs, use the
my $cuid = cuid( );
$cuid.say; # ===> c1xyr5kms0000qb8qtlakvjsj
For slugs (short and weak CUIDs), use the following
my $cuid-slug = cuid-slug( );
$cuid-slug.say; # ===> f900qqno
Happy hacking, kiddo!