/// <summary> /// 分割 key /// </summary> static RedisDbKeyModel SplitKeys(RedisDbModel db, string key) { if (key.IndexOf(SPLITTER) > 0) { var name = key.Substring(0, key.IndexOf(SPLITTER)); var keyModel = new RedisDbKeyModel(db, null) { FullKey = key, Name = name, KeyPrefix = name, }; ResolveKey(keyModel); return(keyModel); } else { return(new RedisDbKeyModel(db, null) { FullKey = key, Name = key, KeyPrefix = key, }); } }
public async Task <(long, IList <RedisDbKeyModel>)> GetKeysAsync(Guid guid, RedisDbModel db) { var keys = await Task.Run(() => { return(_redisClientService.ScanKeys(guid, db.Index)); }); var list = await Task.Run(() => { var temp = keys.Select(t => SplitKeys(db, t)).ToList(); var result = new List <RedisDbKeyModel>(); foreach (var key in temp) { ResolveKeys(key, result); } return(result); }); return(keys.Count, list); }
public async Task FlushDBAsync(RedisDbModel db) { await _redisClientService.FlushDatabaseAsync(db.RedisConnect.Guid, db.Index); }