xgolanglru

package
v0.0.0-...-a89d410 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New[K comparable, V any](c *Config) (localCache *cache.Cache[K, V])

New 构建本地缓存实例 缓存容量默认256MB 最小512KB 最大8GB

func StdNew

func StdNew[K comparable, V any](name string) (localCache *cache.Cache[K, V])

StdNew 构建本地缓存实例 The entry size need less than 1/1024 of cache size

Types

type Config

type Config struct {
	Expire        time.Duration `json:"expire" toml:"expire"`               // 失效时间 【必填】
	DisableMetric bool          `json:"disableMetric" toml:"disableMetric"` // metric上报 false 开启  ture 关闭【选填,默认开启】
	Size          int           `json:"size" toml:"size"`                   // 缓存大小【选填,默认200000】
	Name          string        `json:"-" toml:"-"`                         // 本地缓存名称,用于日志标识&metric上报【选填】
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig 返回默认配置

func StdConfig

func StdConfig(name string) *Config

StdConfig 返回标准配置

Jump to

Keyboard shortcuts

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