Skip to main content

instance.go

instance.go - Overview

This file provides a function to retrieve or create a unique instance ID for DiceDB, storing it in a file named dicedb.iid within the system's temporary directory.

Detailed Documentation

Function: GetOrCreateInstanceID

Purpose: Retrieves or creates a unique instance ID. It checks for the existence of dicedb.iid in the temp directory. If it exists, it reads the ID. Otherwise, it generates a new UUID v6, saves it to the file, and returns it.

Parameters: None

Returns: string - The unique instance ID. Returns an empty string if it fails to create or read the dicedb.iid file.

Getting Started Relevance: YES