cache

package
v2.33.17 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 5 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(ttl time.Duration, cacheSizeMaxMB int64) (*Cache, error)

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) Exist

func (c *Cache) Exist(key ObjectKey) bool

func (*Cache) Get

func (c *Cache) Get(key ObjectKey) (obj interface{}, ok bool)

func (*Cache) Gets

func (c *Cache) Gets() uint64

func (*Cache) Hits

func (c *Cache) Hits() uint64

func (*Cache) Misses

func (c *Cache) Misses() uint64

func (*Cache) Set

func (c *Cache) Set(key ObjectKey, value interface{}) bool

func (*Cache) SetLogger

func (c *Cache) SetLogger(logger log.Logger)

func (*Cache) SetTTL

func (c *Cache) SetTTL(value time.Duration)

func (*Cache) Sets

func (c *Cache) Sets() uint64

type ObjectKey

type ObjectKey string

func Key

func Key(funcName string, fields ...string) ObjectKey

Key creates a cache key from a function name (of who's is reading/writing from/to the cache) and a list of unique key elements.

func (ObjectKey) FuncName

func (o ObjectKey) FuncName() string

FuncName returns the function that created the key

Jump to

Keyboard shortcuts

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