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


C# RedisConnection.Close方法代码示例

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


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

示例1: Setup

 public void Setup()
 {
     var connection = new RedisConnection("127.0.0.1", allowAdmin: true);
     connection.Open();
     connection.Server.FlushDb(0);
     connection.Close(false);
 }
开发者ID:kumaie,项目名称:AspNetRedisProviders,代码行数:7,代码来源:RoleProviderTests.cs

示例2: Get

		public List<string> Get(string prefix)
		{
			List<string> ret = new List<string>();
			RedisConnection connection = new RedisConnection(
				host: DemoSettings.CustomerRedisCache.Url, 
				password: DemoSettings.CustomerRedisCache.Password);
			connection.Open();
			var list = connection.Wait(connection.Keys.Find(0, "cust:" + prefix.Replace(' ', ':') + "*"));
			for (int i = 0; i < Math.Min(5, list.Length); i++)
			{
				ret.Add(list[i].Substring(5).Replace(':', ' '));
			}
			connection.Close(false);
			return ret;
		}
开发者ID:ChrisRisner,项目名称:TestRepo,代码行数:15,代码来源:AutoCompleteController.cs

示例3: Get

		public List<string> Get(string prefix, string category)
		{
			List<string> ret = new List<string>();
			RedisConnection connection = new RedisConnection(
				host: DemoSettings.ProductsRedisCache.Url,
				password: DemoSettings.ProductsRedisCache.Password);
			connection.Open();
			var list = connection.Wait(connection.Keys.Find(0, "prod:" + category + ":" + prefix.Replace(' ', ':') + "*"));
			for (int i = 0; i < Math.Min(5, list.Length); i++)
			{
				string s = list[i].Substring(5);
				s = s.Substring(s.IndexOf(':') + 1);
				ret.Add(s.Replace(':', ' '));
			}
			connection.Close(false);
			return ret;
		}
开发者ID:ChrisRisner,项目名称:TestRepo,代码行数:17,代码来源:ProductAutoCompleteController.cs

示例4: Main

        public static void Main(string[] args)
        {
            var time = new DateTime(2013, 11, 11, 10, 30, 0);
            var redis = new RedisConnection("localhost");
            redis.Wait(redis.Open());

            var activity = new RedisActivityMonitor(redis);

            // Normal activity.
            activity.Beacon("documents:1", time.AddSeconds(-15), 1, "John");
            activity.Beacon("documents:1", time, 2, "Sue");
            activity.Beacon("documents:1", time.AddSeconds(5), 3, "Mary");
            PrintAll(activity, "documents:1", time.AddSeconds(23));

            // Ignore duplicates.
            activity.Beacon("documents:2", time, 1, "John");
            activity.Beacon("documents:2", time.AddSeconds(5), 1, "John");
            PrintAll(activity, "documents:2", time.AddSeconds(7));

            redis.Close(abort: true);

            Console.Read();
        }
开发者ID:TheCloudlessSky,项目名称:RedisCountingActiveUsers,代码行数:23,代码来源:Program.cs

示例5: getTopKeys

		private List<string> getTopKeys(string category, int top)
		{
			List<string> ret = new List<string>();
			RedisConnection connection = new RedisConnection(DemoSettings.ProductsRedisCache.Url,
					password: DemoSettings.ProductsRedisCache.Password);
			connection.Open();
			var list = connection.SortedSets.Range(0, "rate:" + category, start: 0, stop: top, ascending: false).Result;
			foreach (var item in list)
				ret.Add(Encoding.ASCII.GetString(item.Key));
			connection.Close(false);
			return ret;
		}
开发者ID:ChrisRisner,项目名称:TestRepo,代码行数:12,代码来源:HomeController.cs

示例6: getProducts

		private List<Product> getProducts(string category, double start, double end)
		{
			var products = new List<Product>();
			var connection = new RedisConnection(DemoSettings.ProductsRedisCache.Url,
					password: DemoSettings.ProductsRedisCache.Password);
			connection.Open();
			var list = connection.SortedSets.Range(0, "cat:" + category, min: start, max: end, ascending: false).Result;
			foreach (var item in list)
			{
				string[] parts = Encoding.ASCII.GetString(item.Key).Split(':');
				if (parts.Length == 5)
					products.Add(new Product
					{
						Category = parts[0],
						Name = parts[2],
						Price = (int)(double.Parse(parts[3]) * 100) / 100.0,
						Rate = int.Parse(parts[4])
					});
			}
			connection.Close(false);
			return products;
		}
开发者ID:ChrisRisner,项目名称:TestRepo,代码行数:22,代码来源:HomeController.cs

示例7: PrimeProuctCache

		private static void PrimeProuctCache(TextWriter log)
		{
			if (!ConfirmOperation("YOUR CACHE WILL BE FLUSHED! ALL EXISTING INDEXES WILL BE REPLACED! Are you sure?", log))
				return;

			var client = CloudStorageAccount.CreateCloudTableClient();
			var table = client.GetTableReference(DemoSettings.Storage.ProductsTableName);
			var query = from product in table.CreateQuery<Product>() select product;

			var connection = new RedisConnection(DemoSettings.ProductsRedisCache.Url, allowAdmin: true, password: DemoSettings.ProductsRedisCache.Password);
			connection.Open();
			connection.Server.FlushDb(0);
			foreach (var c in query)
			{
				string key = string.Format("{0}:{1}:{2}:{3}:{4}", c.PartitionKey, c.RowKey, c.Name, c.Price, c.Rate);
				log.WriteLine("{0}:{1}", key, c.Name);
				connection.SortedSets.Add(0, "cat:" + c.Category, key, c.Price);
				connection.SortedSets.Add(0, "rate:" + c.Category, key, c.Rate);
				connection.Strings.Set(0, "prod:" + c.Category + ":" + c.Name.Replace(' ', ':'), key);
			}
			connection.Close(false);
		}
开发者ID:ChrisRisner,项目名称:TestRepo,代码行数:22,代码来源:Program.cs


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