cache

package
v0.0.0-...-ee4c243 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func New

func New(maxSizeB int) *Cache

func (*Cache) Delete

func (c *Cache) Delete(key string)

func (*Cache) Get

func (c *Cache) Get(key string) (Value, bool)

func (*Cache) Set

func (c *Cache) Set(key string, val Value)

func (*Cache) SizeB

func (c *Cache) SizeB() int

func (*Cache) Update

func (c *Cache) Update(key string, fn func(v Value) Value)

Update updates the given cache value while locked. If the key is not present, nil is passed to fn. To remove the value, return nil in fn.

type Value

type Value interface {
	SizeB() int
}

Jump to

Keyboard shortcuts

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