Example #1
0
        public RedisDatabase(KeyValueDatabaseOptions <TKeyValueDbContext> options)
        {
            Check.NotNullOrWhiteSpace(options.ConnectionString, nameof(options.ConnectionString));
            var endpoint = options.ConnectionString.ToRedisEndpoint();

            _pooledRedisLite = new PooledRedisLite(endpoint.Host, endpoint.Port, db: (int)endpoint.Db);
        }
Example #2
0
        public static void NormalTest()
        {
            var redis = new PooledRedisLite("192.168.9.9");
            var value = redis.GetString("xxxxxxx");

            Console.WriteLine($"#### {value}");
        }
Example #3
0
        private static void TestSimpleRedis()
        {
            var redis     = new PooledRedisLite("192.168.9.9");
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            var taskArray = new Task[MaxThread];

            for (var i = 0; i < taskArray.Length; i++)
            {
                taskArray[i] = Task.Factory.StartNew(TestSimpleRedisWorker, redis);
            }
            Task.WaitAll(taskArray);
            stopWatch.Stop();
            Console.WriteLine($"SimpleRedis::Thread {MaxThread}, spend: {stopWatch.ElapsedMilliseconds} ms.");
        }