kvmemcache

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 4 Imported by: 0

README

kvmemcache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](conf Config[K, V]) *Cache[K, V]

func (*Cache[K, V]) Evict

func (c *Cache[K, V]) Evict(key K)

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (V, error)

func (*Cache[K, V]) Stats

func (c *Cache[K, V]) Stats() Stats

type Config

type Config[K comparable, V any] struct {
	MaxSize int
	TTL     time.Duration // Zero to ignore.
	Src     func(K) (V, error)
}

type Stats

type Stats struct {
	Hits   uint64
	Misses uint64
}

Jump to

Keyboard shortcuts

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