charlydagos/optimized-uuid

Uuids for optimized storage

dev-master 2016-08-10 09:11 UTC

This package is not auto-updated.

Last update: 2024-09-28 19:26:05 UTC


README

Small and simple package implementing an efficient way of storing UUIDs in a MySQL (InnoDB) database.

Credit for the actual research goes to Karthik Appigatla, and his blog post for Percona

https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/

This is available for download through packagist here

https://packagist.org/packages/charlydagos/optimized-uuid

Usage

This library depends on ramsey/uuid.

To use it you could do

<?php
use Charlydagos\OptimizedUuid\OptimizedUuid;

$uuid = ...; // exisitng uuid string
$optimizedUuid = OptimizedUuid::toOrderedUuid($uuid);

Or create an object with an exisitng Uuid object

<?php
use Ramsey\Uuid\Uuid;
use Charlydagos\OptimizedUuid\OptimizedUuid;

$uuid = Uuid::uuid1();
$optimizedUuid = new OptimizedUuid($uuid);

License

Please see the LICENSE file in this repo.