cache

package
v0.0.0-...-d4345c0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: GPL-3.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeDiskCache

func InitializeDiskCache(_ func(key string) []byte, _ func(key string, value []byte), _ func(key string) bool)

Types

type CalculateFunc

type CalculateFunc[Key comparable, Value any] func(key Key) Value

type ComputationCache

type ComputationCache[Key comparable, Value any] struct {
	Calculate CalculateFunc[Key, Value]
	Data      map[Key]Value
}

func NewComputationCache

func NewComputationCache[Key comparable, Value any](f CalculateFunc[Key, Value]) *ComputationCache[Key, Value]

func (*ComputationCache[Key, Value]) Get

func (c *ComputationCache[Key, Value]) Get(key Key) Value

type DiskCache

type DiskCache interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Exists(key string) bool
}

func Disk

func Disk() DiskCache

Jump to

Keyboard shortcuts

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