int64cache

package
v5.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Impl

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

Impl implements the LocalCache interface

func NewInt64Cache

func NewInt64Cache(maxSize int) (*Impl, error)

NewInt64Cache returns a new LocalCache instance of the specified size and TTL

func (*Impl) Get

func (c *Impl) Get(key int64) (int64, error)

Get retrieves an item if exist, nil + an error otherwise

func (*Impl) Set

func (c *Impl) Set(key int64, value int64) error

Set adds a new item. Since the cache being full results in removing the LRU element, this method never fails.

type Int64Cache

type Int64Cache interface {
	Get(key int64) (int64, error)
	Set(key int64, value int64) error
}

Int64Cache is an in-memory TTL & LRU cache

type Miss

type Miss struct {
	Key int64
}

Miss is a special error indicating the key was not found in the cache

func (*Miss) Error

func (m *Miss) Error() string

Jump to

Keyboard shortcuts

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