cache

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataCache

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

DataCache maintain data

func NewDataCache

func NewDataCache(id uint64, expire int64) *DataCache

NewDataCache create a new DataCache

type DataCacheContainer

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

DataCacheContainer handle DataCache of keys

func NewDataCacheContainer

func NewDataCacheContainer(idleTimeout int, expire int64, isSearchCache bool, logger logging.ILogger) *DataCacheContainer

NewDataCacheContainer create a new DataCacheContainer

func (*DataCacheContainer) GetStat

func (cc *DataCacheContainer) GetStat() map[uint64]*DataCacheStat

GetStat -

func (*DataCacheContainer) Input

func (cc *DataCacheContainer) Input(dp IDataPoint)

Input data to the container

func (*DataCacheContainer) PrintStat

func (cc *DataCacheContainer) PrintStat()

PrintStat -

func (*DataCacheContainer) Search

func (cc *DataCacheContainer) Search(request *SearchRequest) ([]IDataPoint, error)

Search data in the container

func (*DataCacheContainer) Start

func (cc *DataCacheContainer) Start(isPrintStat bool)

Start the container

func (*DataCacheContainer) Stop

func (cc *DataCacheContainer) Stop()

Stop the container

type DataCacheStat

type DataCacheStat struct {
	Count  int
	Size   uint64
	From   int64
	To     int64
	Expire int64
}

DataCacheStat contains the stat of the DataCache

type DataPoint

type DataPoint struct {
	ID   uint64
	Time time.Time
	Data []byte
}

DataPoint is a structure for holding data of a time point

func (*DataPoint) Append

func (d *DataPoint) Append(data IDataPoint)

Append -

func (*DataPoint) GetID

func (d *DataPoint) GetID() uint64

GetID -

func (*DataPoint) GetSize

func (d *DataPoint) GetSize() uint64

GetSize -

func (*DataPoint) GetTime

func (d *DataPoint) GetTime() int64

GetTime -

type IDataPoint

type IDataPoint interface {
	GetID() uint64
	GetTime() int64
	GetSize() uint64
	Append(data IDataPoint)
}

IDataPoint -

type SearchRequest

type SearchRequest struct {
	ID       uint64
	TimeFrom int64 // us
	TimeTo   int64 // us
}

SearchRequest is a request for search data in the DataCache

Jump to

Keyboard shortcuts

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