Documentation
¶
Index ¶
- Variables
- type CacheItem
- type CacheTable
- func (table *CacheTable) Add(key string, liftSpan time.Duration, data []byte) error
- func (table *CacheTable) Del(key string) error
- func (table *CacheTable) Exists(key string) (bool, []byte)
- func (table *CacheTable) NotFoundAdd(key string, liftSpan time.Duration, data []byte) (bool, error)
- func (table *CacheTable) SetAboutToDeleteItemCallback(f func(*CacheItem))
- func (table *CacheTable) SetAddedItemCallback(f func(*CacheItem))
- type CacheTxs
- type PersistItem
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyNotFound gets returned when a specific key couldn't be found ErrKeyNotFound = errors.New("Key not found in cache") ErrItem = errors.New("make item fail") )
Functions ¶
This section is empty.
Types ¶
type CacheItem ¶
func NewCacheItem ¶
NewCacheItem returns a newly created CacheItem.
func (*CacheItem) SetAboutToExpireCallback ¶
func (item *CacheItem) SetAboutToExpireCallback(f func(interface{}))
SetAboutToExpireCallback before the item is about to be removed from the cache.
type CacheTable ¶
func NewCacheTable ¶
func NewCacheTable(table string) *CacheTable
func (*CacheTable) Del ¶
func (table *CacheTable) Del(key string) error
func (*CacheTable) NotFoundAdd ¶
func (*CacheTable) SetAboutToDeleteItemCallback ¶
func (table *CacheTable) SetAboutToDeleteItemCallback(f func(*CacheItem))
SetAboutToDeleteItemCallback set Callback for an item is about to be removed from the cache.
func (*CacheTable) SetAddedItemCallback ¶
func (table *CacheTable) SetAddedItemCallback(f func(*CacheItem))
SetAddedItemCallback set Callback for a new item is added to the cache.
type CacheTxs ¶
type CacheTxs struct {
// contains filtered or unexported fields
}
func (*CacheTxs) Add ¶
func (ntc *CacheTxs) Add(tx *types.Transaction, chainIDs []byte) error
Add add new tx, at the same time we put tx to db
func (*CacheTxs) Del ¶
func (ntc *CacheTxs) Del(tx *types.Transaction) error
Del del this tx from cache
func (*CacheTxs) Exists ¶
func (ntc *CacheTxs) Exists(tx *types.Transaction) (bool, []byte)
Exists whether tx exists
func (*CacheTxs) NotFoundAdd ¶
NotFoundAdd add tx if not exists, return if exists
type PersistItem ¶
type PersistItem struct {
// contains filtered or unexported fields
}
PersistItem
Click to show internal directories.
Click to hide internal directories.