Core implementation for high-performance unique identifiers.
Provides functions for generating and manipulating Flakes - 192-bit identifiers that combine nanosecond timestamps with high-entropy random data to ensure both uniqueness and monotonic ordering properties.
Core implementation for high-performance unique identifiers. Provides functions for generating and manipulating Flakes - 192-bit identifiers that combine nanosecond timestamps with high-entropy random data to ensure both uniqueness and monotonic ordering properties.
(age-millis f)Returns the age of a Flake in milliseconds.
Calculates the time elapsed since the Flake was created.
Returns the age of a Flake in milliseconds. Calculates the time elapsed since the Flake was created.
(age-nanos f)Returns the age of a Flake in nanoseconds.
Calculates the time elapsed since the Flake was created.
Returns the age of a Flake in nanoseconds. Calculates the time elapsed since the Flake was created.
(as-bytes f)Returns the byte array representation of a Flake.
Returns a 24-byte array containing the Flake's raw data.
Returns the byte array representation of a Flake. Returns a 24-byte array containing the Flake's raw data.
(as-hex f)Converts a Flake to its hexadecimal representation.
Returns a 48-character lowercase hexadecimal string.
Converts a Flake to its hexadecimal representation. Returns a 48-character lowercase hexadecimal string.
(compare-flakes f1 f2)Compare two flakes, returns negative if f1 < f2, zero if equal, positive if f1 > f2
Compare two flakes, returns negative if f1 < f2, zero if equal, positive if f1 > f2
(flake)Generates a new Flake with current timestamp and random components.
Returns a 192-bit identifier that is guaranteed to be larger than any previously generated Flake in the same thread.
Generates a new Flake with current timestamp and random components. Returns a 192-bit identifier that is guaranteed to be larger than any previously generated Flake in the same thread.
(flake-bytes f)Get the byte array representation of a flake
Get the byte array representation of a flake
(flake-string)Generates a new Flake as a URL-safe string representation.
Returns a 32-character string that preserves the monotonic ordering of the underlying Flake values.
Generates a new Flake as a URL-safe string representation. Returns a 32-character string that preserves the monotonic ordering of the underlying Flake values.
(flake? x)Checks if the given value is a Flake instance.
Checks if the given value is a Flake instance.
(from-string s)Parses a Flake from its string representation.
Returns a Flake instance or nil if the input is invalid.
Parses a Flake from its string representation. Returns a Flake instance or nil if the input is invalid.
(make-flake byte-data)(make-flake timestamp-nanos random-high random-low)Create a flake with specific timestamp and random components (for testing)
Create a flake with specific timestamp and random components (for testing)
(read-flake flake-str)Reader method for #flake/flake tagged literals.
Reader method for #flake/flake tagged literals.
(timestamp f)Extracts the timestamp component from a Flake.
Returns the nanosecond timestamp indicating when the Flake was created.
Extracts the timestamp component from a Flake. Returns the nanosecond timestamp indicating when the Flake was created.
(timestamp-millis f)Extracts the timestamp component as milliseconds since epoch.
Converts the nanosecond timestamp to milliseconds for easier interoperability with standard time libraries.
Extracts the timestamp component as milliseconds since epoch. Converts the nanosecond timestamp to milliseconds for easier interoperability with standard time libraries.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |