コード例 #1
0
        public List <TransactionRecordModel> GetListLatest(int total)
        {
            var list = _transactionRepository.ListLatest(total);

            RedisCacheHelper.TrySetCache(ConfigDataKey.LatestTransactionListCacheKey, list);
            return(list);
        }
コード例 #2
0
        public async Task <ProducersModel> GetListProducers()
        {
            var model = await _blockInfoRepository.ListProducers();

            RedisCacheHelper.TrySetCache(ConfigDataKey.LatestProducerListCacheKey, model);
            return(model);
        }
コード例 #3
0
        public async Task <BlockListModel> GetListLatest()
        {
            var model = await _blockInfoRepository.ListLatest(ConfigDataKey.BlockInfoListLatestTotal);

            RedisCacheHelper.TrySetCache(ConfigDataKey.LatestBlockListCacheKey, model);
            return(model);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #6
0
 protected bool TrySetCache(string key, object data, TimeSpan?expiredTime = null)
 {
     return(RedisCacheHelper.TrySetCache(key, data, expiredTime));
 }