bigmemcache

package
v0.0.0-...-7b2b7a7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigMemCache

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

BigMemCache stores serialized items (feature as example) in memory. Item is serialized as []byte to avoid excessive GC stress and extra memory footprint.

func NewBigMemCache

func NewBigMemCache(cfg *BigMemCacheCfg) (*BigMemCache, error)

NewBigMemCache 返回BigMemCache实例.

func (*BigMemCache) Add

func (bmc *BigMemCache) Add(fe *Feature) error

Add 将特征对象添加进BigMemCache.

func (*BigMemCache) Del

func (bmc *BigMemCache) Del(uuid string) error

Del 将特征对象从BigMemCache删除.

func (*BigMemCache) Get

func (bmc *BigMemCache) Get(uuid string) *Feature

Get 从BigMemCache中获取特征对象.

func (*BigMemCache) Reset

func (bmc *BigMemCache) Reset() error

Reset 真正意义上去清理缓存.

func (*BigMemCache) Size

func (bmc *BigMemCache) Size() int

Size 返回BigMemCache当前缓存的对象数量.

type BigMemCacheCfg

type BigMemCacheCfg struct {
	MaxNumOfCacheItem  uint64 // 最多可缓存的对象数量
	MaxSizeOfCacheItem uint64 // 对象大小, unit is byte
}

BigMemCacheCfg BigMemCache配置

type Feature

type Feature struct {
	Version     int32
	UUID        string
	Meta        []byte
	Blob        []byte
	CreatedTime int64
}

Feature 范指代AI领域的特征对象.

Jump to

Keyboard shortcuts

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