cache

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT 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 NewCache

func NewCache(ttl time.Duration, maxCost int64) (*Cache, error)

func (*Cache) Get

func (r *Cache) Get(key string) (any, bool)

func (*Cache) Set

func (r *Cache) Set(key string, val any)

type CacheInstance

type CacheInstance struct {
	TTL time.Duration `json:"TTL" mapstructure:"TTL"` // minisecond
}

type CacheMethod

type CacheMethod interface {

	// Get returns the value for the given key.
	Get(key string) (any, bool)

	// Set sets the value for the given key.
	Set(key string, val any)
}

Jump to

Keyboard shortcuts

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