cache

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 6 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(ctx context.Context, key K) ResourceFuture[V]
	LoadSync(ctx context.Context, key K) (Resource[V], error)
	// Delete deletes resource with the given key from cache.
	Delete(key K) bool
	// Len returns current amount of keys in cache.
	Len() int
}

func NewManager

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

type Resource

type Resource[T any] interface {
	Get() T
	Release()
}

type ResourceFuture

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

type Storage

type Storage[K any, V any] interface {
	Load(ctx context.Context, key K) (Resource[V], error)
}

Jump to

Keyboard shortcuts

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