cache

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithNotFoundTtl

func WithNotFoundTtl[T any](notFoundTtl time.Duration) func(cache *cache[T])

Types

type Cache

type Cache[T any] interface {
	Contains(key string) bool
	Expire(key string) bool
	Get(key string) (T, bool)
	Set(key string, value T)
	SetX(key string, value T, ttl time.Duration)
	Provide(key string, provider func() T) T
	ProvideWithError(key string, provider func() (T, error)) (T, error)
}

func New

func New[T any](maxSize int64, pruneCount uint32, ttl time.Duration, options ...Option[T]) Cache[T]

func NewWithConfiguration

func NewWithConfiguration[T any](config ccache.Configuration, ttl time.Duration, options ...Option[T]) Cache[T]

type Option

type Option[T any] func(*cache[T])

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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