cache

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StoreCacheMgr

type StoreCacheMgr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

StoreCacheMgr provide handle to cache instances

func NewStoreCacheMgr

func NewStoreCacheMgr(chainId string, blockWriteBufferSize int, logger protocol.Logger) *StoreCacheMgr

NewStoreCacheMgr construct a new `StoreCacheMgr` with given chainId

func (*StoreCacheMgr) AddBlock

func (mgr *StoreCacheMgr) AddBlock(blockHeight uint64, updateBatch protocol.StoreBatcher)

AddBlock cache a block with given block height and update batch

func (*StoreCacheMgr) Clear

func (mgr *StoreCacheMgr) Clear()

func (*StoreCacheMgr) DelBlock

func (mgr *StoreCacheMgr) DelBlock(blockHeight uint64)

DelBlock delete block for the given block height

func (*StoreCacheMgr) Get

func (mgr *StoreCacheMgr) Get(key string) ([]byte, bool)

Get returns value if the key in cache, or returns nil if none exists.

func (*StoreCacheMgr) GetPendingBlockSize

func (mgr *StoreCacheMgr) GetPendingBlockSize() int

func (*StoreCacheMgr) Has

func (mgr *StoreCacheMgr) Has(key string) (bool, bool)

Has returns true if the key in cache, or returns false if none exists.

func (*StoreCacheMgr) LockForFlush

func (mgr *StoreCacheMgr) LockForFlush()

LockForFlush used to lock cache until all cache item be flushed to db

func (*StoreCacheMgr) UnLockFlush

func (mgr *StoreCacheMgr) UnLockFlush()

UnLockFlush used to unlock cache by release all semaphore

Jump to

Keyboard shortcuts

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