Message_templates.Timestamp_cacheMillisecond-precision timestamp caching
Provides efficient timestamp generation by caching results at millisecond granularity. Each OCaml domain maintains its own cache for lock-free access.
Typical usage:
let timestamp = Timestamp_cache.get_ptime () in
let rfc3339 = Timestamp_cache.get_rfc3339 () in
()type entry = private {epoch_ms : int64;Milliseconds since Unix epoch
*)ptime : Ptime.t;Ptime representation
*)rfc3339 : string;Pre-formatted RFC3339 string
*)}Cache entry type - exposed for testing
val get : unit -> entryGet cached timestamp entry, creating or refreshing if necessary
If caching is disabled, always creates a fresh entry. Otherwise returns cached entry if from current millisecond.
Get current timestamp as RFC3339 string (cached at millisecond granularity)
Enable or disable timestamp caching
When disabled, all timestamp operations bypass the cache. This is useful for testing or when precise per-event timing is required.