Exemple #1
0
 public async Task <ProducersModel> ListProducers()
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestProducerListCacheKey, out ProducersModel model) ||
         model == null)
     {
         model = await GetListProducers();
     }
     return(model);
 }
Exemple #2
0
 public async Task <BlockListModel> ListLatest()
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestBlockListCacheKey, out BlockListModel model) ||
         model == null)
     {
         model = await GetListLatest();
     }
     return(model);
 }
Exemple #3
0
 public HomeStatisticalModel HomeStatistical()
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestBlockCacheKey, out HomeStatisticalModel model) ||
         model == null)
     {
         model = GetLatestStatistical();
     }
     return(model);
 }
Exemple #4
0
 public List <TransactionRecordModel> ListLatest(int total)
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestTransactionListCacheKey,
                                       out List <TransactionRecordModel> list) ||
         list == null)
     {
         list = GetListLatest(total);
     }
     return(list);
 }
Exemple #5
0
        private List <TokenAccountModel> GetTokenAccounts(string symbol, string code)
        {
            decimal symbolCode;

            try
            {
                symbolCode = Convert.ToDecimal(new SymbolCode(symbol).Value);
            }
            catch (Exception e)
            {
                return(new List <TokenAccountModel>());
            }

            var cacheKey = GetTokenAccountsCacheKey(code, symbolCode);

            if (!RedisCacheHelper.TryGetCache(cacheKey, out List <TokenAccountModel> list) ||
                list == null)
            {
                list = GetAccountsOfToken(code, symbolCode);
            }
            return(list);
        }
Exemple #6
0
 protected bool TryGetCache <TValue>(string key, out TValue result)
 {
     return(RedisCacheHelper.TryGetCache(key, out result));
 }