當前位置: 首頁>>代碼示例>>C#>>正文


C# RedisClient.FlushDb方法代碼示例

本文整理匯總了C#中ServiceStack.Redis.RedisClient.FlushDb方法的典型用法代碼示例。如果您正苦於以下問題:C# RedisClient.FlushDb方法的具體用法?C# RedisClient.FlushDb怎麽用?C# RedisClient.FlushDb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ServiceStack.Redis.RedisClient的用法示例。


在下文中一共展示了RedisClient.FlushDb方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ClearAll

 public static void ClearAll()
 {
     using (var client = new RedisClient(CacheIp))
     {
         client.FlushDb();
         client.FlushAll();
     }
 }
開發者ID:rjonker1,項目名稱:lightstone-data-platform,代碼行數:8,代碼來源:TestCacheRepository.cs

示例2: ShouldSerializeDateEntitiesInListsWithTimeZoneOffset

        public static void ShouldSerializeDateEntitiesInListsWithTimeZoneOffset()
        {
            var date = DateTime.Now;
            using (var redis = new RedisClient())
            {
                redis.FlushDb();

                var list = redis.As<DateTime>().Lists["listId"];
                list.Add(date);             // silently drops timezone offset (0400)
                var dateFromList = list[0]; // fetch the incorrectly stored date
                Assert.AreEqual(date.ToLocalTime(), dateFromList.ToLocalTime());

            }
        }
開發者ID:kylehodgson,項目名稱:RedisIssues,代碼行數:14,代碼來源:SerializationBugProof.cs

示例3: data_to_redis

        public ActionResult data_to_redis()
        {
            DataTable table = GetDataTable("select distinct road from   familiarrealty_f.houseinfo");

            HashSet<string> non_rep_address = new HashSet<string>();
            List<String> json_strings = new List<String>();

            ServiceStack.Redis.RedisClient redis = new ServiceStack.Redis.RedisClient();
            redis.FlushDb();

            foreach (DataRow row in table.Rows) {
                var json_result = new { road = row["road"].ToString() };
                redis.AddItemToList("road:geo", json_result.ToJSON());
                json_strings.Add(json_result.ToJSON());
                non_rep_address.Add(json_result.ToJSON());
            }

            //Response.Write(String.Format(@"non_rep_address count is {0},json_string_count is {1}",non_rep_address.Count,json_strings.Count));
            return new RenderJsonResult {
                  Result =  json_strings
            };
        }
開發者ID:gakaki,項目名稱:FML-API,代碼行數:22,代碼來源:AboutController.cs

示例4: Can_failover_MqServer_at_runtime

        public void Can_failover_MqServer_at_runtime()
        {
            const int iterations = 100;
            var failoverHost = "redis-failover:6379";
            var localClient = new RedisClient("localhost:6379");

            localClient.FlushDb();
            var failoverClient = new RedisClient(failoverHost);
            failoverClient.FlushDb();

            var clientManager = new PooledRedisClientManager(new[] { "localhost" });
            var mqHost = new RedisMqServer(clientManager);

            var map = new Dictionary<string, int>();
            var received = 0;
            mqHost.RegisterHandler<Msg>(c =>
            {
                var dto = c.GetBody();
                received++;
                int count;
                map.TryGetValue(dto.Host, out count);
                map[dto.Host] = count + 1;

                lock (clientManager)
                {
                    "Received #{0} from {1}".Print(received, dto.Host);
                    if (received == iterations)
                        Monitor.Pulse(clientManager);
                }

                return null;
            });

            mqHost.Start();

            RunMqInLoop(mqHost, iterations: iterations, callback: () =>
            {
                lock (clientManager)
                    "{0} msgs were published.".Print(iterations);
            });

            Thread.Sleep(500);

            clientManager.FailoverTo(failoverHost);

            lock (clientManager)
                Monitor.Wait(clientManager);

            "localclient inq: {0}, outq: {1}".Print(
                localClient.GetListCount("mq:Msg.inq"),
                localClient.GetListCount("mq:Msg.outq"));
            "failoverClient inq: {0}, outq: {1}".Print(
                failoverClient.GetListCount("mq:Msg.inq"),
                failoverClient.GetListCount("mq:Msg.outq"));

            Assert.That(received, Is.EqualTo(100));
            Assert.That(map.Count, Is.EqualTo(2));
            var msgsFromAllHosts = 0;
            foreach (var count in map.Values)
            {
                Assert.That(count, Is.GreaterThan(0));
                msgsFromAllHosts += count;
            }
            Assert.That(msgsFromAllHosts, Is.EqualTo(iterations));
        }
開發者ID:arielsrv,項目名稱:ServiceStack,代碼行數:65,代碼來源:RedisFailoverTests.cs

示例5: GetConnection

 private RedisClient GetConnection()
 {
     if (_client == null)
     {
         _client = new RedisClient("TestDataLinux", 6379);
         _client.FlushDb();
     }
     return _client;
 }
開發者ID:nagyistoce,項目名稱:OsmSharp-data-providers,代碼行數:9,代碼來源:RedisDataCacheTests.cs

示例6: CleanOldRedisData

		private void CleanOldRedisData()
		{
			using (var redisClient = new RedisClient(RedisServerUri))
			{
				redisClient.FlushDb();
			}
		}
開發者ID:pacoweb,項目名稱:ravendb,代碼行數:7,代碼來源:ReplicateToRedis.cs


注:本文中的ServiceStack.Redis.RedisClient.FlushDb方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。