CreateULID()
Generates a ULID (Universally Unique Lexicographically Sortable Identifier), a 128-bit identifier where the first 48 bits are a timestamp representing milliseconds since the Unix Epoch (1970-01-01), ensuring temporal ordering.
The remaining 80 bits are populated by a secure random number generator, contributing to the identifier's uniqueness. The output is a 26-character string in its canonical representation.
This function can operate in three modes specified by the 'type' argument:
emptyfor standard ULID generationmonotonicto ensure sequential IDs even in rapid succession- and
hashto generate a ULID based on hashed input values.
ULIDs are better for insert performance, as they don't create sparse B-Tree indexes like UUIDs, saving disk space
Introduced: 6.0.1.65
CreateULID( type=string, input1=number, input2=string );
Returns: String
| Argument | Description | Default |
|---|---|---|
|
type
string,
optional
|
edit
Specifies the generation mode of the ULID. If not defined, a standard ULID is generated.
|
|
|
input1
number,
optional
|
edit
Used in conjunction with the only used for hash |
|
|
input2
string,
optional
|
edit
Similar to |
Examples
editloop times=3 {
dump( createULID() );
}
loop times=3 {
dump( createUUID() );
}
See also
- Core CFML Language
- CreateGUID()
- CreateUUID()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)