当前位置: 首页>>代码示例>>C#>>正文


C# RedisClient.GetValue方法代码示例

本文整理汇总了C#中RedisClient.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.GetValue方法的具体用法?C# RedisClient.GetValue怎么用?C# RedisClient.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedisClient的用法示例。


在下文中一共展示了RedisClient.GetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Working_with_int_values

		public void Working_with_int_values()
		{
			const string intKey = "intkey";
			const int intValue = 1;

			//STORING AN INT USING THE BASIC CLIENT
			using (var redisClient = new RedisClient(TestConfig.SingleHost))
			{
				redisClient.SetEntry(intKey, intValue.ToString());
				string strGetIntValue = redisClient.GetValue(intKey);
				int toIntValue = int.Parse(strGetIntValue);

				Assert.That(toIntValue, Is.EqualTo(intValue));
			}

			//STORING AN INT USING THE GENERIC CLIENT
			using (var redisClient = new RedisClient(TestConfig.SingleHost))
			{
				//Create a generic client that treats all values as ints:
				IRedisTypedClient<int> intRedis = redisClient.GetTypedClient<int>();

				intRedis.SetEntry(intKey, intValue);
				var toIntValue = intRedis.GetValue(intKey);

				Assert.That(toIntValue, Is.EqualTo(intValue));
			}
		}
开发者ID:nataren,项目名称:NServiceKit.Redis,代码行数:27,代码来源:ValueTypeExamples.cs

示例2: Can_connect_to_ssl_azure_redis

 public void Can_connect_to_ssl_azure_redis()
 {
     using (var client = new RedisClient(connectionString))
     {
         client.Set("foo", "bar");
         var foo = client.GetValue("foo");
         foo.Print();
     }
 }
开发者ID:swatabc,项目名称:ServiceStack.Redis,代码行数:9,代码来源:SslTests.cs

示例3: Can_connect_to_ssl_azure_redis_with_UrlFormat

 public void Can_connect_to_ssl_azure_redis_with_UrlFormat()
 {
     var url = "redis://{0}?ssl=true&password={1}".Fmt(Host, Password.UrlEncode());
     using (var client = new RedisClient(url))
     {
         client.Set("foo", "bar");
         var foo = client.GetValue("foo");
         foo.Print();
     }
 }
开发者ID:swatabc,项目名称:ServiceStack.Redis,代码行数:10,代码来源:SslTests.cs

示例4: Transaction_fails_if_first_command

		public void Transaction_fails_if_first_command()
		{
			var redis = new RedisClient(TestConfig.SingleHost);
			using (var trans = redis.CreateTransaction())
			{
				trans.QueueCommand(r => r.IncrementValue("A"));

				trans.Commit();
			}
			Assert.That(redis.GetValue("A"), Is.EqualTo("1"));
		}
开发者ID:appfigures,项目名称:ServiceStack.Redis,代码行数:11,代码来源:ReportedIssues.cs

示例5: UseClient

        private static void UseClient(RedisClient client, int clientNo)
        {
            var host = "";

            try
            {
                host = client.Host;

                Log("Client '{0}' is using '{1}'", clientNo, client.Host);

                var testClientKey = "test:" + host + ":" + clientNo;
                client.SetEntry(testClientKey, testData);
                var result = client.GetValue(testClientKey) ?? "";

                Log("\t{0} => {1} len {2} {3} len", testClientKey,
                    testData.Length, testData.Length == result.Length ? "==" : "!=", result.Length);

            }
            catch (NullReferenceException ex)
            {
                Debug.WriteLine("NullReferenceException StackTrace: \n" + ex.StackTrace);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(String.Format("\t[[email protected]{0}]: {1} => {2}",
                    host, ex.GetType().Name, ex.Message));
            }
        }
开发者ID:ServiceStack,项目名称:ServiceStack.Redis,代码行数:28,代码来源:MultiThreadedRedisClientIntegrationTests.cs


注:本文中的RedisClient.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。