Beispiel #1
0
 public async Task <ProducersModel> ListProducers()
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestProducerListCacheKey, out ProducersModel model) ||
         model == null)
     {
         model = await GetListProducers();
     }
     return(model);
 }
Beispiel #2
0
 public async Task <BlockListModel> ListLatest()
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestBlockListCacheKey, out BlockListModel model) ||
         model == null)
     {
         model = await GetListLatest();
     }
     return(model);
 }
Beispiel #3
0
 public HomeStatisticalModel HomeStatistical()
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestBlockCacheKey, out HomeStatisticalModel model) ||
         model == null)
     {
         model = GetLatestStatistical();
     }
     return(model);
 }
Beispiel #4
0
 public List <TransactionRecordModel> ListLatest(int total)
 {
     if (!RedisCacheHelper.TryGetCache(ConfigDataKey.LatestTransactionListCacheKey,
                                       out List <TransactionRecordModel> list) ||
         list == null)
     {
         list = GetListLatest(total);
     }
     return(list);
 }
Beispiel #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);
        }
Beispiel #6
0
 protected bool TryGetCache <TValue>(string key, out TValue result)
 {
     return(RedisCacheHelper.TryGetCache(key, out result));
 }