cache

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountIndexNameKeyPrefix  = "in:" //key for cache: accountIndex -> accountName
	AccountIndexPkKeyPrefix    = "ip:" //key for cache: accountIndex -> accountPk
	AccountNameKeyPrefix       = "n:"  //key for cache: accountName -> accountIndex
	AccountPkKeyPrefix         = "k:"  //key for cache: accountPk -> accountIndex
	AccountByIndexKeyPrefix    = "a:"  //key for cache: accountIndex -> account
	AccountCountKeyPrefix      = "ac"  //key for cache: total account count
	BlockByHeightKeyPrefix     = "h:"  //key for cache: blockHeight -> block
	BlockByCommitmentKeyPrefix = "c:"  //key for cache: blockCommitment -> block
	BlockCountKeyPrefix        = "bc"  //key for cache: total block count
	TxByHashKeyPrefix          = "h:"  //key for cache: txHash -> tx
	TxCountKeyPrefix           = "tc"  //key for cache: total tx count
	AssetCountKeyKeyPrefix     = "AC"  //key for cache: total asset count
	AssetIdNameKeyPrefix       = "IN:" //key for cache: assetId -> assetName
	AssetIdSymbolKeyPrefix     = "IS:" //key for cache: assetId -> assetName
	AssetByIdKeyPrefix         = "I:"  //key for cache: assetId -> asset
	AssetBySymbolKeyPrefix     = "S:"  //key for cache: assetSymbol -> asset
	PriceKeyPrefix             = "p:"  //key for cache: symbol -> price
	SysConfigKeyPrefix         = "s:"  //key for cache: configName -> sysconfig
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MemCache

type MemCache struct {
	// contains filtered or unexported fields
}

func MustNewMemCache added in v0.0.4

func MustNewMemCache(accountModel accdao.AccountModel, assetModel assetdao.AssetModel,
	accountExpiration, blockExpiration, txExpiration,
	assetExpiration, priceExpiration int, maxCounterNum, maxKeyNum int64) *MemCache

func (*MemCache) GetAccountIndexByName

func (m *MemCache) GetAccountIndexByName(accountName string) (int64, error)

func (*MemCache) GetAccountIndexByPk

func (m *MemCache) GetAccountIndexByPk(accountPk string) (int64, error)

func (*MemCache) GetAccountNameByIndex

func (m *MemCache) GetAccountNameByIndex(accountIndex int64) (string, error)

func (*MemCache) GetAccountPkByIndex

func (m *MemCache) GetAccountPkByIndex(accountIndex int64) (string, error)

func (*MemCache) GetAccountTotalCountWiltFallback

func (m *MemCache) GetAccountTotalCountWiltFallback(f fallback) (int64, error)

func (*MemCache) GetAccountWithFallback

func (m *MemCache) GetAccountWithFallback(accountIndex int64, f fallback) (*accdao.Account, error)

func (*MemCache) GetAssetByIdWithFallback

func (m *MemCache) GetAssetByIdWithFallback(assetId int64, f fallback) (*assetdao.Asset, error)

func (*MemCache) GetAssetBySymbolWithFallback

func (m *MemCache) GetAssetBySymbolWithFallback(assetSymbol string, f fallback) (*assetdao.Asset, error)

func (*MemCache) GetAssetNameById

func (m *MemCache) GetAssetNameById(assetId int64) (string, error)

func (*MemCache) GetAssetSymbolById

func (m *MemCache) GetAssetSymbolById(assetId int64) (string, error)

func (*MemCache) GetAssetTotalCountWithFallback

func (m *MemCache) GetAssetTotalCountWithFallback(f fallback) (int64, error)

func (*MemCache) GetBlockByCommitmentWithFallback

func (m *MemCache) GetBlockByCommitmentWithFallback(blockCommitment string, f fallback) (*blockdao.Block, error)

func (*MemCache) GetBlockByHeightWithFallback

func (m *MemCache) GetBlockByHeightWithFallback(blockHeight int64, f fallback) (*blockdao.Block, error)

func (*MemCache) GetBlockTotalCountWithFallback

func (m *MemCache) GetBlockTotalCountWithFallback(f fallback) (int64, error)

func (*MemCache) GetPriceWithFallback

func (m *MemCache) GetPriceWithFallback(symbol string, f fallback) (float64, error)

func (*MemCache) GetSysConfigWithFallback

func (m *MemCache) GetSysConfigWithFallback(configName string, f fallback) (*sysconfig.SysConfig, error)

func (*MemCache) GetTxByHashWithFallback

func (m *MemCache) GetTxByHashWithFallback(txHash string, f fallback) (*tx.Tx, error)

func (*MemCache) GetTxTotalCountWithFallback

func (m *MemCache) GetTxTotalCountWithFallback(f fallback) (int64, error)

func (*MemCache) SetPrice

func (m *MemCache) SetPrice(symbol string, price float64)

Jump to

Keyboard shortcuts

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