Documentation ¶
Index ¶
- Variables
- func NoRefOrUnrefCachePage(cp *CachePage)
- func RefCachePage(cp *CachePage)
- func SetPageSize(s int64)
- func SetPageSizeByConf(confPageSize string)
- func SetReadDataCacheLimitSize(size uint64)
- func SetReadMetaCacheLimitSize(size uint64)
- func UnrefCachePage(cp *CachePage)
- type CachePage
- type PagePool
- type ReadCacheInstance
- func (c *ReadCacheInstance) AddPage(key string, value []byte, size int64)
- func (c *ReadCacheInstance) AddPageCache(key string, cachePage *CachePage, size int64)
- 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()
- func (c *ReadCacheInstance) PurgeAndUnrefCachePage()
- func (c *ReadCacheInstance) RefreshOldBuffer()
- func (c *ReadCacheInstance) RefreshOldBufferAndUnrefCachePage()
- func (c *ReadCacheInstance) Remove(filePath string) bool
- func (c *ReadCacheInstance) RemovePageCache(filePath string) bool
Constants ¶
This section is empty.
Variables ¶
var CachePagePool = NewPagePool()
var IsPageSizeVariable bool
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 PagePool ¶ added in v1.2.0
type PagePool struct {
// contains filtered or unexported fields
}
func NewPagePool ¶ added in v1.2.0
func NewPagePool() *PagePool
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