This repository has been archived on 2026-10-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2024-07-19 14:54:48 +01:00
2024-07-19 14:54:48 +01:00
2024-07-19 14:54:34 +01:00
2024-07-19 14:54:43 +01:00
2024-07-11 17:33:18 +01:00
2024-07-19 14:54:20 +01:00
2024-06-21 21:54:44 +01:00

Go Registry

This package provides a simple registry implementation which allows storing arbitrary values in a memory map.

You can also lock specific keys to prevent them being written, even if no value has yet been set. Locked keys cannot be unlocked.

Example

package main

import (
	"fmt"

	"github.com/annybs/go/registry"
)

func main() {
	r := registry.New()

	r.Set("some key", "some text")
	fmt.Println(r.Get("some key"))

	r.Lock("some key")
	if err := r.Set("some key", "different text"); err != nil {
		fmt.Println(err)
	}
}

License

See LICENSE.md

S
Description
No description provided
Readme
33 KiB
Languages
Go 100%