gcache

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 6 Imported by: 0

README

gcache

Concurrency-safe Go caching library with generics support, different data storages and stats monitoring.

GoVersion Build GoReportCard CoverageStatus GoDoc License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = store.ErrNotFound

ErrNotFound indicates that key not found in the cache.

Functions

This section is empty.

Types

type Cache added in v0.0.4

type Cache[KeyType comparable, ValueType any] interface {
	Get(KeyType) (ValueType, error)
	Set(KeyType, ValueType) error
	Delete(KeyType) error
	Clear() error

	GetWithContext(context.Context, KeyType) (ValueType, error)
	SetWithContext(context.Context, KeyType, ValueType) error
	DeleteWithContext(context.Context, KeyType) error
	ClearWithContext(context.Context) error

	UseStats()
	ResetStats()
	Stats() (stats.Stats, bool)
}

Cache represents the interface for all caches

func New added in v0.0.4

func New[K comparable, V any](s store.Store) Cache[K, V]

New creates a new instance of cache object.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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