Documentation
¶
Index ¶
- Variables
- func NoRefOrUnrefCachePage(cp *CachePage)
- func RefCachePage(cp *CachePage)
- func SetMataPageListByConf(confPageList []string)
- func SetPageSize(s int64)
- func SetPageSizeByConf(confPageSize string)
- func SetReadDataCacheLimitSize(size uint64)
- func SetReadMetaCacheLimitSize(size uint64)
- func UnrefCachePage(cp *CachePage)
- func UnrefMetaCachePage(cp *CachePage)
- type CachePage
- type DataPagePool
- type MetaPagePool
- type MetaPagePoolItem
- type PagePool
- type ReadCacheInstance
- func (c *ReadCacheInstance) AddPage(key string, value []byte, size int64, pool PagePool)
- func (c *ReadCacheInstance) AddPageCache(key string, cachePage *CachePage, size int64, pool PagePool)
- func (c *ReadCacheInstance) Close()
- func (c *ReadCacheInstance) Contains(key string) bool
- func (c *ReadCacheInstance) CreateCacheKey(filePath string, offset int64) string
- func (c *ReadCacheInstance) CreateCacheKeys(filePath string, blockIds []int64) []string
- func (c *ReadCacheInstance) Get(key string) (value interface{}, hit bool)
- func (c *ReadCacheInstance) GetByteSize() int64
- func (c *ReadCacheInstance) GetHitRatio() (Ratio float64)
- func (c *ReadCacheInstance) GetPageCache(key string) (value interface{}, hit bool)
- func (c *ReadCacheInstance) GetPageSize() int
- func (c *ReadCacheInstance) Purge(pool PagePool)
- func (c *ReadCacheInstance) PurgeAndUnrefCachePage(pool PagePool)
- func (c *ReadCacheInstance) RefreshOldBuffer(pool PagePool)
- func (c *ReadCacheInstance) RefreshOldBufferAndUnrefCachePage(pool PagePool)
- func (c *ReadCacheInstance) Remove(filePath string) bool
- func (c *ReadCacheInstance) RemovePageCache(filePath string) bool
Constants ¶
This section is empty.
Variables ¶
var ( PageSize int64 = 32 * 1024 // default 32kb MetaPageSizeList []int64 = []int64{} )
var CachePagePool = NewPagePool()
var IsMetaUseHierarchicalPool bool
var IsPageSizeVariable bool
var MetaCachePool = NewMetaPagePool()
Functions ¶
func NoRefOrUnrefCachePage ¶ added in v1.2.0
func NoRefOrUnrefCachePage(cp *CachePage)
func RefCachePage ¶ added in v1.2.0
func RefCachePage(cp *CachePage)
func SetMataPageListByConf ¶ added in v1.4.0
func SetMataPageListByConf(confPageList []string)
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)
func UnrefMetaCachePage ¶ added in v1.4.0
func UnrefMetaCachePage(cp *CachePage)
Types ¶
type DataPagePool ¶ added in v1.4.0
type DataPagePool struct {
// contains filtered or unexported fields
}
func NewPagePool ¶ added in v1.2.0
func NewPagePool() *DataPagePool
func (*DataPagePool) Get ¶ added in v1.4.0
func (p *DataPagePool) Get() *CachePage
func (*DataPagePool) Put ¶ added in v1.4.0
func (p *DataPagePool) Put(pp *CachePage)
type MetaPagePool ¶ added in v1.4.0
type MetaPagePool struct {
// contains filtered or unexported fields
}
func NewMetaPagePool ¶ added in v1.4.0
func NewMetaPagePool() *MetaPagePool
func (*MetaPagePool) Get ¶ added in v1.4.0
func (p *MetaPagePool) Get() *CachePage
func (*MetaPagePool) GetBySize ¶ added in v1.4.0
func (p *MetaPagePool) GetBySize(size int64) *CachePage
func (*MetaPagePool) InitPools ¶ added in v1.4.0
func (p *MetaPagePool) InitPools()
func (*MetaPagePool) Put ¶ added in v1.4.0
func (p *MetaPagePool) Put(pp *CachePage)
func (*MetaPagePool) SetLimit ¶ added in v1.4.0
func (p *MetaPagePool) SetLimit(val uint64)
func (*MetaPagePool) Size ¶ added in v1.4.0
func (p *MetaPagePool) Size() int64
type MetaPagePoolItem ¶ added in v1.4.0
type MetaPagePoolItem struct {
// contains filtered or unexported fields
}
func (*MetaPagePoolItem) Get ¶ added in v1.4.0
func (p *MetaPagePoolItem) Get() *CachePage
func (*MetaPagePoolItem) GetBySize ¶ added in v1.4.0
func (p *MetaPagePoolItem) GetBySize(size int64) (*CachePage, bool)
func (*MetaPagePoolItem) Put ¶ added in v1.4.0
func (p *MetaPagePoolItem) 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, pool PagePool)
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, pool PagePool)
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(pool PagePool)
Purge clear all data in the cache instance.
func (*ReadCacheInstance) PurgeAndUnrefCachePage ¶ added in v1.2.0
func (c *ReadCacheInstance) PurgeAndUnrefCachePage(pool PagePool)
func (*ReadCacheInstance) RefreshOldBuffer ¶
func (c *ReadCacheInstance) RefreshOldBuffer(pool PagePool)
RefreshOldBuffer clear oldBuffer, put currBuffer to oldBuffer, then clear currBuffer.
func (*ReadCacheInstance) RefreshOldBufferAndUnrefCachePage ¶ added in v1.2.0
func (c *ReadCacheInstance) RefreshOldBufferAndUnrefCachePage(pool PagePool)
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