cache

package
v0.0.45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[K cache.Hasher] struct {
	// contains filtered or unexported fields
}

Cache is a cache of keyvalue.Connections accessed by their config.

func New

func New[K cache.Hasher](create CreationFunc[K], equals cache.EqualsFunc[K], lg log.Interface) *Cache[K]

New returns a new keyvalue.Connection cache.

func (*Cache[_]) Close

func (c *Cache[_]) Close() error

Close closes the cache.

func (*Cache[K]) Get

func (c *Cache[K]) Get(ctx context.Context, cfg K) (keyvalue.Connection, error)

Get returns a storage with given config.

type CreationFunc

type CreationFunc[K cache.Hasher] func(context.Context, K) (keyvalue.Connection, error)

CreationFunc creates a new value for the given key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL