readcache

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCacheLimitSize

func SetCacheLimitSize(size uint64)

Types

type CachePage

type CachePage struct {
	Value []byte
	Size  int64
}

type ReadCacheInstance

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

func GetReadCacheIns

func GetReadCacheIns() *ReadCacheInstance

GetReadCacheIns Get a single instance of readCache, if you want to change totalLimitSize, please use Resize method.

func (*ReadCacheInstance) AddPage

func (c *ReadCacheInstance) AddPage(key string, value []byte, size int64) (evict bool)

AddPage adds a byteArray value to the ReadCacheInstance, and Without this key, it will build a new page. Returns true if an eviction occurred.

func (*ReadCacheInstance) Close

func (c *ReadCacheInstance) Close()

func (*ReadCacheInstance) Contains

func (c *ReadCacheInstance) Contains(key string) bool

Contains checks if a key is in the cache.

func (*ReadCacheInstance) CreatCacheKey

func (c *ReadCacheInstance) CreatCacheKey(filePath string, offset int64) string

func (*ReadCacheInstance) Get

func (c *ReadCacheInstance) Get(key string) (value interface{}, hit bool)

Get looks up a key's value from the ReadCacheInstance.

func (*ReadCacheInstance) GetByteSize

func (c *ReadCacheInstance) GetByteSize() int64

GetByteSize Get fileBlockCache byte size

func (*ReadCacheInstance) GetHitRatio

func (c *ReadCacheInstance) GetHitRatio() (Ratio float64)

GetHitRatio get cache hit ratio

func (*ReadCacheInstance) GetPageSize

func (c *ReadCacheInstance) GetPageSize() int

func (*ReadCacheInstance) Purge

func (c *ReadCacheInstance) Purge()

Purge clear all data in the cache instance.

func (*ReadCacheInstance) RefreshOldBuffer

func (c *ReadCacheInstance) RefreshOldBuffer()

RefreshOldBuffer clear oldBuffer, put currBuffer to oldBuffer, then clear currBuffer.

func (*ReadCacheInstance) Remove

func (c *ReadCacheInstance) Remove(filePath string) bool

Remove cache context based on filePath

Jump to

Keyboard shortcuts

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