package kv

import "git.sr.ht/~xn/cache/v2/kv"

Index

Types

type KV

type KV[V any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

KV - Key Value store

func New

func New[V any]() *KV[V]

New KV store

func (*KV[V]) Get

func (c *KV[V]) Get(key string) V

Get an item from store

func (*KV[V]) Has

func (c *KV[V]) Has(key string) bool

Has check if an item exists in store

func (*KV[V]) Purge

func (c *KV[V]) Purge()

Purge store

func (*KV[V]) Remove

func (c *KV[V]) Remove(key string)

Remove an item from store

func (*KV[V]) Set

func (c *KV[V]) Set(key string, value V)

Set an item to store

Source Files

kv.go

Version
v2.1.0 (latest)
Published
Aug 29, 2022
Platform
linux/amd64
Imports
2 packages
Last checked
3 months ago

Tools for package owners.