readcache

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CachePagePool = NewPagePool()
View Source
var IsPageSizeVariable bool
View Source
var (
	PageSize int64 = 32 * 1024 // default 32kb
)

Functions

func NoRefOrUnrefCachePage added in v1.2.0

func NoRefOrUnrefCachePage(cp *CachePage)

func RefCachePage added in v1.2.0

func RefCachePage(cp *CachePage)

func SetPageSize added in v1.2.0

func SetPageSize(s int64)

func SetPageSizeByConf added in v1.2.0

func SetPageSizeByConf(confPageSize string)

func SetReadDataCacheLimitSize added in v1.2.0

func SetReadDataCacheLimitSize(size uint64)

func SetReadMetaCacheLimitSize added in v1.2.0

func SetReadMetaCacheLimitSize(size uint64)

func UnrefCachePage added in v1.2.0

func UnrefCachePage(cp *CachePage)

Types

type CachePage

type CachePage struct {
	Value []byte
	Size  int64
	// contains filtered or unexported fields
}

func (*CachePage) Ref added in v1.2.0

func (cp *CachePage) Ref()

func (*CachePage) Unref added in v1.2.0

func (cp *CachePage) Unref()

type PagePool added in v1.2.0

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

func NewPagePool added in v1.2.0

func NewPagePool() *PagePool

func (*PagePool) Get added in v1.2.0

func (p *PagePool) Get() *CachePage

func (*PagePool) Put added in v1.2.0

func (p *PagePool) Put(pp *CachePage)

type ReadCacheInstance

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

func GetReadDataCacheIns added in v1.2.0

func GetReadDataCacheIns() *ReadCacheInstance

GetReadDataCacheIns Get a single instance of readDataCache, if you want to change readDataCacheLimitSize, please use Resize method.

func GetReadMetaCacheIns added in v1.2.0

func GetReadMetaCacheIns() *ReadCacheInstance

GetReadMetaCacheIns Get a single instance of readMetaCache, if you want to change readMetaCacheLimitSize, please use Resize method.

func (*ReadCacheInstance) AddPage

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

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) AddPageCache added in v1.2.0

func (c *ReadCacheInstance) AddPageCache(key string, cachePage *CachePage, size int64)

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) CreateCacheKey added in v1.2.0

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

func (*ReadCacheInstance) CreateCacheKeys added in v1.2.0

func (c *ReadCacheInstance) CreateCacheKeys(filePath string, blockIds []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) GetPageCache added in v1.2.0

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

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) PurgeAndUnrefCachePage added in v1.2.0

func (c *ReadCacheInstance) PurgeAndUnrefCachePage()

func (*ReadCacheInstance) RefreshOldBuffer

func (c *ReadCacheInstance) RefreshOldBuffer()

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

func (*ReadCacheInstance) RefreshOldBufferAndUnrefCachePage added in v1.2.0

func (c *ReadCacheInstance) RefreshOldBufferAndUnrefCachePage()

func (*ReadCacheInstance) Remove

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

Remove cache context based on filePath

func (*ReadCacheInstance) RemovePageCache added in v1.2.0

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

Jump to

Keyboard shortcuts

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