Exemple #1
0
        public async Task <RShardingConfig[]> ShardingConfigGetFromCache(EnumDefine.ShardGroupEnum shardGroup)
        {
            string key = ShardingConfigKey(shardGroup);

            RShardingConfig[] configs = await _redisStorage.HashGetAll <RShardingConfig>(key);

            if (configs == null)
            {
                var configsFromDb = await _shardingConfigDao.Get(shardGroup);

                configs = configsFromDb?.Select(p => new RShardingConfig()
                {
                    Id             = p.Id,
                    Type           = p.Type,
                    Status         = p.Status,
                    UpdatedUid     = p.UpdatedUid,
                    CreatedUid     = p.CreatedUid,
                    Config         = p.Config,
                    CreatedDate    = p.CreatedDate,
                    DatabaseName   = p.DatabaseName,
                    HostName       = p.HostName,
                    Pwd            = p.Pwd,
                    ShardGroup     = p.ShardGroup,
                    ShardGroupName = p.ShardGroupName,
                    StatusName     = p.StatusName,
                    TypeName       = p.TypeName,
                    Uid            = p.Uid,
                    UpdatedDate    = p.UpdatedDate
                }).ToArray();
            }
            return(configs);
        }
Exemple #2
0
 public async Task <IList <TEntity> > GetAll()
 {
     return(await redisStorage.HashGetAll <TEntity>(key));
 }
 public async Task <RCurrency[]> Get()
 {
     return(await _redisStorage.HashGetAll <RCurrency>(StorageKey));
 }