coreCache

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 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[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Cache 是一个线程安全的只读高并发缓存

func NewCache added in v0.0.22

func NewCache[K comparable, V any]() *Cache[K, V]

NewCache 初始化

func (*Cache[K, V]) Delete added in v0.0.22

func (c *Cache[K, V]) Delete(key K)

Delete 删除

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (V, bool)

Get 读操作(无锁、零拷贝)

func (*Cache[K, V]) GetAll added in v0.0.23

func (c *Cache[K, V]) GetAll() map[K]V

GetAll 获取所有数据(无锁、零拷贝)

func (*Cache[K, V]) Len added in v0.0.22

func (c *Cache[K, V]) Len() int

Len 获取当前缓存大小(监控用)

func (*Cache[K, V]) ReplaceAll added in v0.0.22

func (c *Cache[K, V]) ReplaceAll(newMap map[K]V)

ReplaceAll 全量替换(数据库 reload)

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(key K, val V)

Set 添加 / 更新(copy-on-write)

Jump to

Keyboard shortcuts

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