cache

package
v0.2.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager[K comparable, V any] interface {
	Load(key K) Ref[V]
	// Delete marks key as expired.
	Delete(key K) bool
	// Len returns current amount of keys in cache.
	Len() int
	// Cleanup starts scanning for expired values
	// and removes deleted values from storage.
	Cleanup() int
}

func NewManager

func NewManager[K comparable, V any](storage Storage[K, V]) Manager[K, V]

type Ref

type Ref[T any] interface {
	futures.Future[T]
	Release()
}

type Storage

type Storage[K comparable, V any] interface {
	Get(key K) (V, error)
	Actual(key K, value V) bool
	Delete(key K, value V) error
}

Jump to

Keyboard shortcuts

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