Ejemplo n.º 1
0
        public List <TransactionRecordModel> GetListLatest(int total)
        {
            var list = _transactionRepository.ListLatest(total);

            RedisCacheHelper.TrySetCache(ConfigDataKey.LatestTransactionListCacheKey, list);
            return(list);
        }
Ejemplo n.º 2
0
        public async Task <ProducersModel> GetListProducers()
        {
            var model = await _blockInfoRepository.ListProducers();

            RedisCacheHelper.TrySetCache(ConfigDataKey.LatestProducerListCacheKey, model);
            return(model);
        }
Ejemplo n.º 3
0
        public async Task <BlockListModel> GetListLatest()
        {
            var model = await _blockInfoRepository.ListLatest(ConfigDataKey.BlockInfoListLatestTotal);

            RedisCacheHelper.TrySetCache(ConfigDataKey.LatestBlockListCacheKey, model);
            return(model);
        }
Ejemplo n.º 4
0
        public List <TokenAccountModel> GetAccountsOfToken(string code, decimal symbolCode)
        {
            var cacheKey = GetTokenAccountsCacheKey(code, symbolCode);
            var list     = _contractRepository.GetTokenAccounts(code, symbolCode);

            if (list != null && list.Any())
            {
                RedisCacheHelper.TrySetCache(cacheKey, list, TimeSpan.FromSeconds(ConfigDataKey.TokenAccountsListCacheExpired));
            }
            return(list);
        }
Ejemplo n.º 5
0
        public HomeStatisticalModel GetLatestStatistical()
        {
            var model = new HomeStatisticalModel();

            model.Tps = _blockInfoRepository.GetTps();

            var total = _transactionRepository.GetTotal();

            model.TransactionTotal = total;

            var lastBlock = _blockInfoRepository.GetLastBlock();

            model.BlockNum = lastBlock.BlockNum;
            model.Node     = lastBlock.Producer;

            RedisCacheHelper.TrySetCache(ConfigDataKey.LatestBlockCacheKey, model);

            return(model);
        }
Ejemplo n.º 6
0
 protected bool TrySetCache(string key, object data, TimeSpan?expiredTime = null)
 {
     return(RedisCacheHelper.TrySetCache(key, data, expiredTime));
 }