public async Task Push() { var list = new RedisList<int>(GlobalSettings.Default, "listkey1"); await list.Delete(); (await list.LeftPush(1)).Is(1); (await list.LeftPush(10)).Is(2); (await list.LeftPush(new[] { 100, 1000, 10000 }, TimeSpan.FromMilliseconds(1000))).Is(5); (await list.Range()).Is(10000, 1000, 100, 10, 1); await Task.Delay(TimeSpan.FromMilliseconds(1500)); (await list.Exists()).IsFalse(); (await list.RightPush(1)).Is(1); (await list.RightPush(10)).Is(2); (await list.RightPush(new[] { 100, 1000, 10000 }, TimeSpan.FromMilliseconds(1000))).Is(5); (await list.Range()).Is(1, 10, 100, 1000, 10000); await Task.Delay(TimeSpan.FromMilliseconds(1500)); (await list.Exists()).IsFalse(); }
static void Test4(RedisConnection redisConnection) { var mpSerializer = new MsgPackRedisSerializer(); try { var db = redisConnection.GetDatabase(); db.PingAsync().Wait(); var list = new RedisList <string>(db, "test", mpSerializer); list.Clear(); list.Add("one"); list.Add("two"); list.Add("three"); list[1] = "Ross"; foreach (var str in list) { Console.WriteLine(str); } } catch (Exception ex) { Console.WriteLine(ex); } }
public RedisTaskQueue(ConnectionMultiplexer redis) { _redis = redis; var db = redis.GetDatabase(); _list = new RedisList(db, RedisTaskQueueConstants.QueueKey); }
static void Test1(RedisConnection redisConnection) { try { var db = redisConnection.GetDatabase(); db.PingAsync().Wait(); var list = new RedisList <string>(db, "test"); list.Clear(); list.Add("one"); list.Add("two"); list.Add("three"); list[1] = "Ross"; var bData = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; db.StringSet("some_data", bData); //, TimeSpan.FromSeconds(20)); foreach (var str in list) { Console.WriteLine(str); } } catch (Exception ex) { Console.WriteLine(ex); } }
public async Task GetByIndexRemove() { var list = new RedisList <int>(GlobalSettings.Default, "listkey2"); await list.Delete(); await list.RightPush(new[] { 1, 2, 3, 4, 5 }); (await list.GetByIndex(1)).Value.Is(2); (await list.GetByIndex(10)).HasValue.IsFalse(); (await list.Length()).Is(5); await list.RightPush(new[] { 1, 2, 3, 4, 5, 3 }); await list.Remove(3); (await list.Range()).Is(1, 2, 4, 5, 1, 2, 4, 5); await list.Remove(4, 1); (await list.Range()).Is(1, 2, 5, 1, 2, 4, 5); await list.Remove(5, -1); (await list.Range()).Is(1, 2, 5, 1, 2, 4); }
/// <summary> /// 初始化数据库环境、实例化子类中,所有Set属性 /// </summary> public void Initializer() { if (IsInitializer) { return; } _client = new RedisClient(_redisConnection); IsInitializer = true; Connection = new RedisConnection(_client); Hash = new RedisHash(_client); Key = new RedisKey(_client); List = new RedisList(_client); PubSub = new RedisPubSub(_client); Script = new RedisScript(_client); Server = new RedisServer(_client); Set = new RedisSet(_client); SortedSet = new RedisSortedSet(_client); String = new RedisString(_client); Transaction = new RedisTransaction(_client); Bit = new RedisBit(_client); Expire = new RedisExpire(_client); Sort = new RedisSort(_client); Number = new RedisNumber(_client); }
public static void Main(string[] args) { using (var redis = new RedisClient()) { // Performance to Test // Adding full list to redis // Get all indexes as a time table // want to see how time changes for different items in the list redis.FlushDb(); var data = new MockedData(300000); var list = new RedisList(Guid.NewGuid().ToString(), redis, data); var set = new RedisSortedSet(Guid.NewGuid().ToString(), redis, data); Console.WriteLine("List Testing"); PerformanceTesting.TimeOperation("Insert all data into a list", list.AddAllRecords); PerformanceTesting.TimeOperation("Lookup all records sequentially - one by one", list.LookupRecordsSequentially); Console.WriteLine("++++++++++============================================++++++++++"); Console.WriteLine("Sorted Set Testing"); PerformanceTesting.TimeOperation("Insert all data into a sortedset", set.AddAllRecords); PerformanceTesting.TimeOperation("Lookup all records sequentially - one by one", set.LookupRecordsSequentially); } }
public async Task Push() { var list = new RedisList <int>(GlobalSettings.Default, "listkey1"); await list.Delete(); (await list.LeftPush(1)).Is(1); (await list.LeftPush(10)).Is(2); (await list.LeftPush(new[] { 100, 1000, 10000 }, TimeSpan.FromMilliseconds(1000))).Is(5); (await list.Range()).Is(10000, 1000, 100, 10, 1); await Task.Delay(TimeSpan.FromMilliseconds(1500)); (await list.Exists()).IsFalse(); (await list.RightPush(1)).Is(1); (await list.RightPush(10)).Is(2); (await list.RightPush(new[] { 100, 1000, 10000 }, TimeSpan.FromMilliseconds(1000))).Is(5); (await list.Range()).Is(1, 10, 100, 1000, 10000); await Task.Delay(TimeSpan.FromMilliseconds(1500)); (await list.Exists()).IsFalse(); }
public async Task EmptyRange() { var list = new RedisList <int>(GlobalSettings.Default, "listkey5"); await list.Delete(); (await list.Range()).Length.Is(0); }
public static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var configuration = builder.Build(); var redisConnection = configuration["RedisConnection"]; var redis = ConnectionMultiplexer.Connect(redisConnection); FlushAllDbs(redisConnection); var cache = redis.GetDatabase(); var data = new MockedData(500000); var list = new RedisList(Guid.NewGuid().ToString(), cache, data); // var set = new RedisSortedSet (Guid.NewGuid ().ToString (), cache, data); Console.WriteLine("List Testing"); PerformanceTesting.TimeOperation("Insert all data into a list", list.AddAllRecords); PerformanceTesting.TimeOperation("Lookup all records sequentially - one by one", list.LookupRecord); Console.WriteLine("++++++++++============================================++++++++++"); Console.WriteLine($"Removing list id: {list.Identifier}"); cache.KeyDelete(list.Identifier); // Console.WriteLine ("Sorted Set Testing"); // PerformanceTesting.TimeOperation ("Insert all data into a sorted set", set.AddAllRecords); // PerformanceTesting.TimeOperation ("Lookup all records sequentially - one by one", set.LookupRecordsSequentially); }
public RedisList GetRedisListHandle() { if (redisList == null) { redisList = new RedisList(); } return(redisList); }
public async void MyTestMethod() { // redis list var redis = new RedisList<Person>(RedisServer.Default, "test-list-key"); await redis.AddLast(new Person { Name = "Tom" }); await redis.AddLast(new Person { Name = "Mary" }); var persons = await redis.Range(0, 10); }
public async void MyTestMethod() { // redis list var redis = new RedisList <Person>(RedisServer.Default, "test-list-key"); await redis.AddLast(new Person { Name = "Tom" }); await redis.AddLast(new Person { Name = "Mary" }); var persons = await redis.Range(0, 10); }
//public static Queue<Exception> ExceptionQueue = new Queue<Exception>(); public override void OnException(ExceptionContext filterContext) { base.OnException(filterContext); RedisList.EnqueueItemOnList("ErrorLogs", filterContext.Exception); //ExceptionQueue.Enqueue(filterContext.Exception); if (filterContext.Exception != null) { //string a = filterContext.RouteData.Values["controller"].ToString(); filterContext.HttpContext.Response.Redirect("/Error.html"); } }
public async Task Pop() { var list = new RedisList <int>(GlobalSettings.Default, "listkey6"); await list.Delete(); await list.RightPush(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); (await list.LeftPop()).Value.Is(1); (await list.RightPop()).Value.Is(9); (await list.Range()).Is(2, 3, 4, 5, 6, 7, 8); }
public async Task Insert() { var list = new RedisList<int>(GlobalSettings.Default, "listkey4"); await list.Delete(); await list.RightPush(new[] { 1, 2, 3, 4, 5 }); (await list.Range()).Is(1, 2, 3, 4, 5); (await list.InsertBefore(4, 1000)).Is(6); (await list.Range()).Is(1, 2, 3, 1000, 4, 5); (await list.InsertAfter(4, 2000)).Is(7); (await list.Range()).Is(1, 2, 3, 1000, 4, 2000, 5); }
public async Task LeftPushAndFixLength() { var list = new RedisList<int>(GlobalSettings.Default, "listkey3"); await list.Delete(); await list.LeftPush(new[] { 1, 2, 3, 4, 5 }); await list.LeftPush(new[] { 6, 7, 8, 9, 10 }); (await list.Range()).Is(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); await list.LeftPushAndFixLength(100, 10); (await list.Range()).Is(100, 10, 9, 8, 7, 6, 5, 4, 3, 2); await list.LeftPushAndFixLength(1000, 3); (await list.Range()).Is(1000, 100, 10); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="value">이 값과 같은 것만 지운다</param> /// <param name="count">삭제할 개수. count가 0 보다 크면 왼쪽에서, count가 0 보다 작으면 오른쪽에서, 0과 같으면 모두 지운다</param> /// <returns></returns> public static async Task <long> DeleteListAsync <T>(string key, T value, int count) { try { var redis = new RedisList <T>(redisGroupBasic, key); var result = await redis.Remove(value, count); return(result); } catch (Exception ex) { Console.WriteLine(ex.Message); return(0); } }
public static async Task <List <T> > GetListAsync <T>(string key, int startPos) { try { var redis = new RedisList <T>(redisGroupBasic, key); var result = await redis.Range(startPos, -1); return(result.ToList()); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public static async Task <List <T> > GetList <T>(string key, int startPos, int endPos) { try { var redis = new RedisList <T>(redisGroupBasic, key); var result = await redis.Range(startPos, endPos); return(result.ToList()); } catch (Exception ex) { Logger.Exception(ex.Message); return(null); } }
public async Task Insert() { var list = new RedisList <int>(GlobalSettings.Default, "listkey4"); await list.Delete(); await list.RightPush(new[] { 1, 2, 3, 4, 5 }); (await list.Range()).Is(1, 2, 3, 4, 5); (await list.InsertBefore(4, 1000)).Is(6); (await list.Range()).Is(1, 2, 3, 1000, 4, 5); (await list.InsertAfter(4, 2000)).Is(7); (await list.Range()).Is(1, 2, 3, 1000, 4, 2000, 5); }
public static async Task <long> AddListAsync <T>(string key, T value) { try { var redis = new RedisList <T>(redisGroupBasic, key); var result = await redis.LeftPush(value); return(result); } catch (Exception ex) { Console.WriteLine(ex.Message); return(0); } }
public async Task LeftPushAndFixLength() { var list = new RedisList <int>(GlobalSettings.Default, "listkey3"); await list.Delete(); await list.LeftPush(new[] { 1, 2, 3, 4, 5 }); await list.LeftPush(new[] { 6, 7, 8, 9, 10 }); (await list.Range()).Is(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); await list.LeftPushAndFixLength(100, 10); (await list.Range()).Is(100, 10, 9, 8, 7, 6, 5, 4, 3, 2); await list.LeftPushAndFixLength(1000, 3); (await list.Range()).Is(1000, 100, 10); }
protected void Application_Start() { //让Log4Net配置节点起作用,并注册我们的过滤器 XmlConfigurator.Configure(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //string FileUrl = Server.MapPath("/Logs/"); ThreadPool.QueueUserWorkItem(o => { while (true) { if (RedisList.GetListCount("ErrorLogs") > 0) //if (MyExceptionAttribute.ExceptionQueue.Count() > 0) { //Exception ex = MyExceptionAttribute.ExceptionQueue.Dequeue(); Exception ex = RedisList.DequeueItemFromList <Exception>("ErrorLogs"); if (ex != null) { //File.AppendAllText(FileUrl + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", ex.ToString(), System.Text.Encoding.Unicode); ILog log = LogManager.GetLogger("ErrorName"); log.Error(ex.ToString()); } else { Thread.Sleep(1000); } } else { Thread.Sleep(1000); } } }); //BundleTable.EnableOptimizations = true;//启用优化后:当页面下次再次发送请求的时候 BundleConfig里面没有更改的话、浏览器会从缓存中去取 }
public async Task GetByIndexRemove() { var list = new RedisList<int>(GlobalSettings.Default, "listkey2"); await list.Delete(); await list.RightPush(new[] { 1, 2, 3, 4, 5 }); (await list.GetByIndex(1)).Value.Is(2); (await list.GetByIndex(10)).HasValue.IsFalse(); (await list.Length()).Is(5); await list.RightPush(new[] { 1, 2, 3, 4, 5, 3 }); await list.Remove(3); (await list.Range()).Is(1, 2, 4, 5, 1, 2, 4, 5); await list.Remove(4, 1); (await list.Range()).Is(1, 2, 5, 1, 2, 4, 5); await list.Remove(5, -1); (await list.Range()).Is(1, 2, 5, 1, 2, 4); }
public async Task EmptyRange() { var list = new RedisList<int>(GlobalSettings.Default, "listkey5"); await list.Delete(); (await list.Range()).Length.Is(0); }
static void Main(string[] args) { // Create connectionMultiplexer. Creating connectionMultiplexer is costly so it is recommended to store and reuse it. var connectionMultiplexer = ConnectionMultiplexer.Connect("localhost,abortConnect=false"); // replace localhost with your redis db address // You can either create a RedisType by using RedisTypeFactory or by instantiating the desired type directly. var redisTypeFactory = new RedisTypeFactory(connectionMultiplexer); // Create a redis dictionary under the name of "Person". var redisDictionary = redisTypeFactory.GetDictionary <int, Person>("Person"); // Adding items to dictionary redisDictionary.Add(1, new Person { ID = 1, Name = "Steve", Age = 20 }); redisDictionary.Add(2, new Person { ID = 2, Name = "Mike", Age = 25 }); redisDictionary.Add(3, new Person { ID = 3, Name = "Lara", Age = 30 }); // Iterate through dictionary foreach (var person in redisDictionary) { Console.WriteLine("ID: {0}, Name: {1}, Age: {2}", person.Value.ID, person.Value.Name, person.Value.Age); } Console.WriteLine(); // Find a specific person var lara = redisDictionary.First(kvp => kvp.Value.Name == "Lara"); Console.WriteLine("Lara's Age: {0}", lara.Value.Age); // Delete a person redisDictionary.Remove(lara.Key); // Delete the Person dictionary from redis redisDictionary.Clear(); // Creating a redis list var redisList = new RedisList <int>(connectionMultiplexer.GetDatabase(), "Numbers"); // Adding some numbers to redis list for (int i = 0; i < 10; i++) { redisList.Add(i); } Console.WriteLine(); Console.WriteLine("List Members:"); // Iterating through list foreach (var number in redisList) { Console.WriteLine(number); } // Delete the Numbers list from redis redisList.Clear(); // Using a DI container... var container = new UnityContainer(); // Register connectionMultiplexer as a singleton instance container.RegisterInstance <IConnectionMultiplexer>(connectionMultiplexer); // Register RedisTypeFactory container.RegisterType <IRedisTypeFactory, RedisTypeFactory>(); // Resolve an IRedisTypeFacoty var factory = container.Resolve <IRedisTypeFactory>(); // Get a redis set from factory var redisSet = factory.GetSet <int>("NumbersSet"); redisSet.Add(1); redisSet.Add(1); redisSet.Add(2); Console.WriteLine(); Console.WriteLine("Set Members:"); // Iterating through set foreach (var item in redisSet) { Console.WriteLine(item); } Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.Read(); }
public ApiResult ListPush(string key, string value) { RedisList.LPush(key, value); return(ApiResult.ReturnWebResult(false, "")); }
static void SerializerTests(RedisConnection redisConnection) { try { var json = File.ReadAllText($"{AppDomain.CurrentDomain.BaseDirectory}sample.json"); var myData = new MySerializeData { Data1 = json, Data2 = json, List = new List <string> { json, json, json, json } }; var myData2 = new MySerializeData2 { Data = json, List = new List <TestClass>(), }; for (var i = 0; i < 10; i++) { myData2.List.Add(new TestClass { Id = i, Name = $"Ross: {i}" }); } var jsonSerializer = new JsonRedisSerializer(); var mpSerializer = new MsgPackRedisSerializer(); //var r1 = jsonSerializer.Serialize(myData2); //var r2 = mpSerializer.Serialize(myData2); //var db = redisConnection.GetDatabase(); //var list = new XRedisList<MySerializeData>(db, "test", mpSerializer); //list.Clear(); //list.Add(myData); //list.Add(myData); //list.Add(myData); const int Iteration = 1000; while (true) { Console.WriteLine("Ready..."); var key = Console.ReadKey(); Console.WriteLine(); if (key.KeyChar == 'q') { break; } else if (key.KeyChar == 'c') { Console.Clear(); } else if (key.KeyChar == 'j') { var db = redisConnection.GetDatabase(); var list = new RedisList <MySerializeData>(db, "test", jsonSerializer); list.Clear(); var sw = new Stopwatch(); sw.Start(); for (var i = 0; i < Iteration; i++) { list.Add(myData); var d = list[0]; } sw.Stop(); Console.WriteLine($"{sw.ElapsedMilliseconds} msec for {Iteration} iterations using Json serializer"); } else if (key.KeyChar == 'm') { var db = redisConnection.GetDatabase(); var list = new RedisList <MySerializeData>(db, "test", mpSerializer); list.Clear(); var sw = new Stopwatch(); sw.Start(); for (var i = 0; i < Iteration; i++) { list.Add(myData); var d = list[0]; } sw.Stop(); Console.WriteLine($"{sw.ElapsedMilliseconds} msec for {Iteration} iterations using MsgPack serializer"); } } } catch (Exception ex) { Console.WriteLine(ex); } }
public async Task Pop() { var list = new RedisList<int>(GlobalSettings.Default, "listkey6"); await list.Delete(); await list.RightPush(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); (await list.LeftPop()).Value.Is(1); (await list.RightPop()).Value.Is(9); (await list.Range()).Is(2, 3, 4, 5, 6, 7, 8); }
public HQRedisList(HQRedisDB DB, string Key) : base(DB, Key) { Comm = DB.DB.CreateList <DataType>(Key); }
public void ListTest() { RedisList list = new RedisList(); list.ListTest(); }
public Person(string name) { Name = name; Friends = new RedisList<Person>(RedisServer.Default, "Person-Key-" + Name); }
public Person(string name) { Name = name; Friends = new RedisList <Person>(RedisServer.Default, "Person-Key-" + Name); }
static void Main(string[] args) { // Create connectionMultiplexer. Creating connectionMultiplexer is costly so it is recommended to store and reuse it. var connectionMultiplexer = ConnectionMultiplexer.Connect("localhost,abortConnect=false"); // replace localhost with your redis db address // You can either create a RedisType by using RedisTypeFactory or by instantiating the desired type directly. var redisTypeFactory = new RedisTypeFactory(connectionMultiplexer); // Create a redis dictionary under the name of "Person". var redisDictionary = redisTypeFactory.GetDictionary<int, Person>("Person"); // Adding items to dictionary redisDictionary.Add(1, new Person { ID = 1, Name = "Steve", Age = 20 }); redisDictionary.Add(2, new Person { ID = 2, Name = "Mike", Age = 25 }); redisDictionary.Add(3, new Person { ID = 3, Name = "Lara", Age = 30 }); // Iterate through dictionary foreach (var person in redisDictionary) { Console.WriteLine("ID: {0}, Name: {1}, Age: {2}", person.Value.ID, person.Value.Name, person.Value.Age); } Console.WriteLine(); // Find a specific person var lara = redisDictionary.First(kvp => kvp.Value.Name == "Lara"); Console.WriteLine("Lara's Age: {0}", lara.Value.Age); // Delete a person redisDictionary.Remove(lara.Key); // Delete the Person dictionary from redis redisDictionary.Clear(); // Creating a redis list var redisList = new RedisList<int>(connectionMultiplexer.GetDatabase(), "Numbers"); // Adding some numbers to redis list for (int i = 0; i < 10; i++) { redisList.Add(i); } Console.WriteLine(); Console.WriteLine("List Members:"); // Iterating through list foreach (var number in redisList) { Console.WriteLine(number); } // Delete the Numbers list from redis redisList.Clear(); // Using a DI container... var container = new UnityContainer(); // Register connectionMultiplexer as a singleton instance container.RegisterInstance<IConnectionMultiplexer>(connectionMultiplexer); // Register RedisTypeFactory container.RegisterType<IRedisTypeFactory, RedisTypeFactory>(); // Resolve an IRedisTypeFacoty var factory = container.Resolve<IRedisTypeFactory>(); // Get a redis set from factory var redisSet = factory.GetSet<int>("NumbersSet"); redisSet.Add(1); redisSet.Add(1); redisSet.Add(2); Console.WriteLine(); Console.WriteLine("Set Members:"); // Iterating through set foreach (var item in redisSet) { Console.WriteLine(item); } Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.Read(); }
public RedisQueue(BeetleX.Redis.RedisDB redisDb) { _list = redisDb.CreateList <string>($"L_{typeof(T).Name}"); }
static void Main(string[] args) { SelectDto_Test(); var testRedisList = new RedisList <Search>("Test"); List <Search> searches = new List <Search>(); for (int i = 0; i < 10; i++) { searches.Add(new Search() { IntValue = i }); } testRedisList.AddRange(searches); var getSearches = testRedisList.Where(x => x.IntValue == 3).ToList(); //using (var repo = MongoRepositoryFactory.CreateMongoRepository<Document>()) //{ // repo.Add(new Document() // { // Id = Guid.NewGuid().ToString(), // Data = new byte[] { 1, 2, 3, 4, 5 } // }); // var document = repo.GetAll(x => true).ToList(); //} //try //{ // using (var uow = UnitOfWorkFactory.CreateUnitOfWork<MasterContext>(new UnitOfWorkSettings() // { // ChangeDataCapture = true, // ChangedUserPropertyName = "ChangedBy", // IdPropertyName = "Id" // })) // { // var ct = uow.GetRepository<City>().Get(x => x != null); // uow.GetRepository<City>().Delete(ct); // uow.SaveChanges(); // } //} //catch (Exception e) //{ // Console.WriteLine(e); //} //return; //using (UnitOfWork<MasterContext> uow = new UnitOfWork<MasterContext>()) //{ // var city = new City() { Name = "sivas" }; // var t1 = new Teacher() { Branch = 1, Name = "serhat", City = city }; // var t2 = new Teacher() { Branch = 2, Name = "süha", City = city }; // var s1 = new Student() { StudentNum = 5858, Name = "emre", City = city }; // var s2 = new Student() { StudentNum = 5860, Name = "duhan", City = city }; // uow.GetRepository<City>().Add(city); // uow.GetRepository<Teacher>().Add(t1); // uow.GetRepository<Teacher>().Add(t2); // uow.GetRepository<Student>().Add(s1); // uow.GetRepository<Student>().Add(s2); // uow.SaveChanges(); // var persons = uow.GetRepository<City>().Get(x => x.Id.Equals(1), new List<string>() { "Persons" }) // .Persons; // foreach (var person in persons) // { // if (person is Student) // { // } // else if (person is Teacher) // { // var teacher = (Teacher)person; // } // } //} ElasticLogger.Instance.Info("Info Log", new Dictionary <string, Object>() { { "No", 1 }, { "Name", "DMicroServices Info" } }); try { int a = 0; int b = 10 / a; } catch (Exception ex) { ElasticLogger.Instance.Error(ex, "Exception Log", new Dictionary <string, Object>() { { "No", 1 }, { "Name", "DMicroServices Error" } }); } Console.WriteLine("Hello World!"); Console.ReadLine(); }
public void SetAndGetList() { var list = new RedisList<Person>(RedisServer.Default, ListKey0); var personList = new[] { new Person { Name = "Tom" }, new Person { Name = "Mary" } }; var result = Task.Run(async () => { return await list.RightPush(personList); }); var resultCount = result.Result; Assert.AreEqual(2L, resultCount); var persons = Task.Run(async () => { return await list.Range(0, 10).ConfigureAwait(false); }); var personsResult = persons.Result; Assert.AreEqual(personList, personsResult); Assert.AreEqual(personList[0], personsResult[0]); Assert.AreEqual(personList[1], personsResult[1]); }