Documentation
¶
Index ¶
- func SetCacheLimitSize(size int)
- type CachePage
- type ReadCacheInstance
- func (c *ReadCacheInstance) AddPage(key string, value []byte, size int64) (evict bool)
- func (c *ReadCacheInstance) Close()
- func (c *ReadCacheInstance) Contains(key string) bool
- func (c *ReadCacheInstance) CreatCacheKey(filePath string, offset 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) GetPageSize() int
- func (c *ReadCacheInstance) Purge()
- func (c *ReadCacheInstance) RefreshOldBuffer()
- func (c *ReadCacheInstance) Remove(filePath string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCacheLimitSize ¶
func SetCacheLimitSize(size int)
Types ¶
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
Click to show internal directories.
Click to hide internal directories.