├── .gitignore ├── README.md ├── RedisDemo.sln ├── RedisDemo ├── App.config ├── Models │ ├── ArticleModel.cs │ └── PersonModel.cs ├── Properties │ └── AssemblyInfo.cs ├── RedisDemo.csproj ├── RedisFeaturesDemo.cs ├── RedisGenericDemo.cs ├── RedisHashDemo.cs ├── RedisListDemo.cs ├── RedisSetDemo.cs ├── RedisSortedSetDemo.cs ├── RedisStringDemo.cs └── Utils │ └── RedisHelper.cs └── ReferenceDll ├── FxCommon.dll ├── FxCommon.xml ├── Readme.txt ├── Redis.dll └── Redis.xml /.gitignore: -------------------------------------------------------------------------------- 1 | /*.suo 2 | /RedisDemo/bin 3 | /RedisDemo/obj 4 | /RedisDemo/*.user 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RedisDemo 2 | Redis快速入门及应用 3 | 4 | ## 第7章的Demo下载及更多资料 5 | + RedisDemo下载地址:https://github.com/das2017/RedisDemo 6 | + RedisDesktopManage下载地址:https://redisdesktop.com/ 7 | + Redis官网:https://redis.io/ 8 | + ServiceStack.Redis客户端:https://github.com/ServiceStack/ServiceStack.Redis 9 | + Redis命令大全:http://www.redis.cn/commands.html 10 | 11 | ## 新书上市: 12 | + 京东链接:https://item.jd.com/12477683.html 13 | + 当当链接:http://product.dangdang.com/1436599215.html 14 | + 天猫店铺:https://detail.tmall.com/item.htm?spm=a1z10.3-b.w4011-16861154605.39.46be1b8bGWSsmz&id=585204361262&rn=12e44ccc5bb398b74fdd72e49e2af64e&abbucket=9 15 | 16 | ## 内容简介 17 | 本书结合作者近几年的工作经验,总结了一套可直接落地、基于开源、成本低、可快速搭建的中小研发团队架构实践方法。本书共5篇22章,开篇是本书的导读;架构篇是设计思想的提升,包括企业总体架构、应用架构设计、统一应用分层等;框架篇主讲中间件和工具的使用,包括消息队列、缓存、Job、集中式日志、应用监控和微服务等;公共应用篇是技术与业务的结合,包括单点登录和企业支付网关;进阶篇是从架构到管理,包括技改案例、技术与业务的匹配与融合等。从架构、框架、公共应用,到案例实战和技术管理,本书将大公司的工程理念压缩应用到中小研发团队,使小团队也能构建大网站。 18 | 19 | ## 全书目录 20 |
 21 | 第1篇 开篇
 22 | 1 可参考的才是有价值的(含案例和代码)
 23 | 1.1 框架篇—工欲善其事,必先利其器
 24 | 1.2 架构篇—思想提升
 25 | 1.3 公共应用篇—业务与技术的结合
 26 | 1.4 进阶篇—从架构到管理
 27 | 1.5 案例参考和Demo下载
 28 | 第2篇 架构篇
 29 | 2 企业总体架构
 30 | 2.1 企业商务模型
 31 | 2.2 架构现状
 32 | 2.3 领域模型
 33 | 2.4 架构规划
 34 | 2.5 架构实施
 35 | 2.6 案例参考
 36 | 3 应用架构设计
 37 | 3.1 初识架构设计
 38 | 3.2 应用架构设计案例
 39 | 3.3 更多知识探讨
 40 | 3.4 互联网公司的架构设计要怎么落地
 41 | 3.5 你给技术打个分
 42 | 3.6 案例参考
 43 | 4 统一应用分层
 44 | 4.1 为什么要统一应用分层
 45 | 4.2 统一应用逻辑架构
 46 | 4.3 分层规范实践
 47 | 4.4 互动问答
 48 | 4.5 Demo下载
 49 | 5 生产环境诊断工具WinDbg
 50 | 5.1 诊断工具简介
 51 | 5.2 获取异常进程的Dump文件
 52 | 5.3 WinDbg的使用方法
 53 | 5.4 一个真实案例
 54 | 5.5 Demo下载
 55 | 第3篇 框架篇
 56 | 6 RabbitMQ快速入门及应用
 57 | 6.1 为什么要用消息队列RabbitMQ
 58 | 6.2 RabbitMQ简介
 59 | 6.3 RabbitMQ的工作原理
 60 | 6.4 RabbitMQ的基本用法
 61 | 6.5 Demo下载
 62 | 7 Redis快速入门及应用
 63 | 7.1 Redis简介
 64 | 7.2 Redis的数据结构
 65 | 7.3 Redis的重要特性
 66 | 7.4 使用方法
 67 | 7.5 Redis Key命名规范与常见问题
 68 | 7.6 Demo下载
 69 | 8 任务调度Job
 70 | 8.1 Job简介
 71 | 8.2 WinJob
 72 | 8.3 HttpJob
 73 | 8.4 Cron表达式
 74 | 8.5 Demo下载
 75 | 9 应用监控系统Metrics
 76 | 9.1 Metrics简介
 77 | 9.2 埋点Metrics.NET的方法
 78 | 9.3 Grafana配置
 79 | 9.3.1 设置仪表盘(Dashboard)
 80 | 9.3.2 设置面板(Panel)
 81 | 9.3.3  设置模板Templating
 82 | 9.3.4 设置Time Range
 83 | 9.3.5 告警设置
 84 | 9.4 其他说明
 85 | 9.5 Metrics的使用价值
 86 | 9.6 Demo下载
 87 | 10 集中式日志ELK
 88 | 10.1 集中式日志
 89 | 10.2 配置方法
 90 | 10.3 使用方法
 91 | 10.4 Demo下载
 92 | 11 微服务架构MSA
 93 | 11.1 MSA简介
 94 | 11.2 MSA框架的使用
 95 | 11.3 微服务治理
 96 | 11.4 微服务网关API Gateway
 97 | 11.5 Demo下载
 98 | 12 搜索服务Solr
 99 | 12.1 Solr简介
100 | 12.2 Solr的工作原理
101 | 12.3 Solr的特性
102 | 12.4 Demo下载
103 | 13 分布式协调器ZooKeeper
104 | 13.1 ZooKeeper是什么
105 | 13.2 ZooKeeper的工作原理简介
106 | 13.3 ZooKeeper的典型应用场景
107 | 13.4 Demo下载
108 | 14 小工具合集
109 | 14.1 ORM工具
110 | 14.2 对象映射工具
111 | 14.3 IoC工具
112 | 14.4 DLL包管理工具
113 | 14.5 Demo下载
114 | 15 一键发布和测试之持续集成工具Jenkins
115 | 15.1 Jenkins简介
116 | 15.2 Jenkins插件与相关工具
117 | 15.3 Jenkins关键配置
118 | 15.4 Jenkins的使用价值
119 | 第4篇 公共应用篇
120 | 16 单点登录
121 | 16.1 单点登录简介
122 | 16.2 SSO技术实现
123 | 16.3 JWT规范
124 | 17 企业支付网关
125 | 17.1 企业支付网关介绍
126 | 17.2 统一支付服务
127 | 17.3 统一支付通知
128 | 17.4 Demo下载
129 | 第5篇 进阶篇
130 | 18 技改之路:从单体应用到微服务
131 | 18.1 系统背景
132 | 18.2 前期工作
133 | 18.3 技改实施
134 | 18.4 总结
135 | 18.5 互动问答
136 | 19 机票垂直搜索引擎之性能优化
137 | 19.1 行业背景与垂直搜索
138 | 19.2 主要问题与解决方案
139 | 19.3 静态数据与任务打底
140 | 19.4 缓存策略与数据一致
141 | 19.5 实时查询与三段超时
142 | 19.6 政策匹配与算法优化
143 | 19.7 小结
144 | 20 上云纪要
145 | 20.1 为什么要上云
146 | 20.2 内部虚拟化和外部云化
147 | 20.3 云选型
148 | 20.4 上云八条
149 | 20.5 成功上云
150 | 20.6 上云总结
151 | 21 技术与业务的匹配与融合
152 | 21.1 技术人员与业务人员的抱怨
153 | 21.2 问题出在哪里
154 | 21.3 理解源于彼此的了解
155 | 21.4 如何去匹配与融合
156 | 21.5 什么在驱动公司的发展
157 | 22 研发团队文化是怎么“长”出来的
158 | 22.1 神秘的文化
159 | 22.2 遇到的问题
160 | 22.3 解决之道
161 | 22.4 总结与提升
162 | 22.5 “长”出来的团队文化
163 | 后记
164 | 架构师进阶之路
165 | 谈谈互联网公司的技术架构和管理
166 | 短评
167 | 
168 | -------------------------------------------------------------------------------- /RedisDemo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReferenceDll", "ReferenceDll", "{8C711CDF-EB63-4DD5-90A9-CA62ED4CC483}" 7 | ProjectSection(SolutionItems) = preProject 8 | References\FxCommon.dll = References\FxCommon.dll 9 | References\FxCommon.xml = References\FxCommon.xml 10 | ReferenceDll\Readme.txt = ReferenceDll\Readme.txt 11 | References\Redis.dll = References\Redis.dll 12 | References\Redis.xml = References\Redis.xml 13 | EndProjectSection 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisDemo", "RedisDemo\RedisDemo.csproj", "{A45C11D5-2C9F-4697-B571-6FBEFE421901}" 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Any CPU = Debug|Any CPU 20 | Release|Any CPU = Release|Any CPU 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {A45C11D5-2C9F-4697-B571-6FBEFE421901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {A45C11D5-2C9F-4697-B571-6FBEFE421901}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {A45C11D5-2C9F-4697-B571-6FBEFE421901}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {A45C11D5-2C9F-4697-B571-6FBEFE421901}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | GlobalSection(ExtensibilityGlobals) = postSolution 32 | VisualSVNWorkingCopyRoot = . 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /RedisDemo/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /RedisDemo/Models/ArticleModel.cs: -------------------------------------------------------------------------------- 1 | namespace RedisDemo.Models 2 | { 3 | /// 4 | /// 文章 5 | /// 6 | public class ArticleModel 7 | { 8 | public int Id { get; set; } 9 | /// 10 | /// 标题 11 | /// 12 | public string Title { get; set; } 13 | /// 14 | /// 内容 15 | /// 16 | public string Content { get; set; } 17 | /// 18 | /// 查看数 19 | /// 20 | public int Views { get; set; } 21 | /// 22 | /// 收藏数 23 | /// 24 | public int Favourites { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RedisDemo/Models/PersonModel.cs: -------------------------------------------------------------------------------- 1 | namespace RedisDemo.Models 2 | { 3 | public class PersonModel 4 | { 5 | public long Id { get; set; } 6 | public string Name { get; set; } 7 | public int Age { get; set; } 8 | public string Telephone { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /RedisDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("RedisDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("RedisDemo")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("af3d1163-a06d-4e7e-8d26-2999075c49d5")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedisDemo/RedisDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A45C11D5-2C9F-4697-B571-6FBEFE421901} 8 | Exe 9 | Properties 10 | RedisDemo 11 | RedisDemo 12 | v4.0 13 | 512 14 | 发布\ 15 | true 16 | Disk 17 | false 18 | Foreground 19 | 7 20 | Days 21 | false 22 | false 23 | true 24 | 0 25 | 1.0.0.%2a 26 | false 27 | false 28 | true 29 | 30 | 31 | AnyCPU 32 | true 33 | full 34 | false 35 | bin\Debug\ 36 | DEBUG;TRACE 37 | prompt 38 | 4 39 | 40 | 41 | AnyCPU 42 | pdbonly 43 | true 44 | bin\Release\ 45 | TRACE 46 | prompt 47 | 4 48 | 49 | 50 | 51 | ..\ReferenceDll\FxCommon.dll 52 | 53 | 54 | ..\ReferenceDll\Redis.dll 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Designer 82 | 83 | 84 | 85 | 86 | False 87 | Microsoft .NET Framework 4 %28x86 和 x64%29 88 | true 89 | 90 | 91 | False 92 | .NET Framework 3.5 SP1 Client Profile 93 | false 94 | 95 | 96 | False 97 | .NET Framework 3.5 SP1 98 | false 99 | 100 | 101 | False 102 | Windows Installer 4.5 103 | true 104 | 105 | 106 | 107 | 114 | -------------------------------------------------------------------------------- /RedisDemo/RedisFeaturesDemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using RedisDemo.Utils; 4 | using ServiceStack.Redis; 5 | using ServiceStack.Text; 6 | 7 | namespace RedisDemo 8 | { 9 | /// 10 | /// Redis 特性 11 | /// 12 | public class RedisFeaturesDemo 13 | { 14 | public static void Main1() 15 | { 16 | Pipelining(); 17 | 18 | Transaction(); 19 | 20 | Redlock(); 21 | 22 | Geo(); 23 | 24 | Console.ReadLine(); 25 | } 26 | 27 | /// 28 | /// 管道 29 | /// 30 | private static void Pipelining() 31 | { 32 | Console.WriteLine("---------------------Pipelining----------------------"); 33 | 34 | using (var client = RedisHelper.GetRedisClient()) 35 | { 36 | const string stringKey = "150101:pipeline:string"; 37 | const string setKey = "150101:pipeline:set"; 38 | 39 | using (var pipeline = client.CreatePipeline()) 40 | { 41 | pipeline.QueueCommand(cli => cli.SetValue(stringKey, "stringvalue")); 42 | pipeline.QueueCommand(cli => cli.AddItemToSet(setKey, "12")); 43 | 44 | pipeline.Flush(); 45 | } 46 | 47 | Console.WriteLine("{0}的值为:{1}", stringKey, client.GetValue(stringKey)); 48 | Console.WriteLine("{0}的元素:{1}", setKey, client.GetAllItemsFromSet(setKey).Dump()); 49 | } 50 | } 51 | 52 | /// 53 | /// 事务 54 | /// 55 | private static void Transaction() 56 | { 57 | Console.WriteLine("---------------------Transaction----------------------"); 58 | 59 | using (var client = RedisHelper.GetRedisClient()) 60 | { 61 | //bool somethingWrong = false; 62 | bool somethingWrong = true; 63 | const string stringKey = "150101:tran:string"; 64 | const string hashKey = "150101:tran:hash"; 65 | const string listKey = "150101:tran:list"; 66 | 67 | using (var transaction = client.CreateTransaction()) 68 | { 69 | try 70 | { 71 | transaction.QueueCommand(cli => cli.SetValue(stringKey, "teststring", TimeSpan.FromSeconds(180))); 72 | transaction.QueueCommand(cli => cli.SetEntryInHash(hashKey, "hashfield", "hashvalue")); 73 | transaction.QueueCommand(cli => cli.AddItemToList(listKey, "listitem1")); 74 | if (somethingWrong) throw new Exception(); 75 | 76 | transaction.Commit(); 77 | } 78 | catch (Exception) 79 | { 80 | transaction.Rollback(); 81 | } 82 | } 83 | 84 | Console.WriteLine("{0}的值为:{1}", stringKey, client.GetValue(stringKey)); 85 | Console.WriteLine("{0}的元素:{1}", hashKey, client.GetAllEntriesFromHash(hashKey).Dump()); 86 | Console.WriteLine("{0}的元素:{1}", listKey, client.GetAllItemsFromList(listKey).Dump()); 87 | } 88 | } 89 | 90 | /// 91 | /// 分布式锁 92 | /// 93 | private static void Redlock() 94 | { 95 | using (var client = RedisHelper.GetRedisClient()) 96 | { 97 | const string key = "150101:locker"; 98 | const string counterKey = "150101:counter"; 99 | 100 | client.SetValue(counterKey, "56"); 101 | using (client.AcquireLock(key, TimeSpan.FromSeconds(10))) 102 | { 103 | client.SetValue(counterKey, "85"); 104 | client.GetValue(counterKey).Print(); 105 | } 106 | } 107 | } 108 | 109 | /// 110 | /// 地理信息 111 | /// 112 | private static void Geo() 113 | { 114 | using (var client = RedisHelper.GetRedisClient()) 115 | { 116 | const string key = "150101:cities"; 117 | 118 | client.AddGeoMembers(key, new[] 119 | { 120 | new RedisGeo(113.14, 23.08, "广州"), 121 | new RedisGeo(113.06, 23.02, "佛山"), 122 | new RedisGeo(114.22, 23.05, "惠州"), 123 | new RedisGeo(114.07, 22.33, "深圳"), 124 | new RedisGeo(113.34, 22.17, "珠海"), 125 | new RedisGeo(117.17, 31.52, "合肥"), 126 | new RedisGeo(116.24, 39.55, "北京"), 127 | new RedisGeo(103.51, 36.04, "兰州"), 128 | new RedisGeo(106.42, 26.35, "贵阳"), 129 | new RedisGeo(110.20, 20.02, "海口"), 130 | new RedisGeo(114.30, 38.02, "石家庄"), 131 | new RedisGeo(113.40, 34.46, "郑州"), 132 | new RedisGeo(126.36, 45.44, "哈尔滨"), 133 | new RedisGeo(114.17, 30.35, "武汉"), 134 | new RedisGeo(112.59, 28.12, "长沙"), 135 | new RedisGeo(125.19, 43.54, "长春"), 136 | new RedisGeo(118.46, 32.03, "南京"), 137 | new RedisGeo(115.55, 28.40, "南昌"), 138 | new RedisGeo(123.25, 41.48, "沈阳"), 139 | new RedisGeo(101.48, 36.38, "西宁"), 140 | new RedisGeo(117, 36.40, "济南"), 141 | new RedisGeo(112.33, 37.54, "太原"), 142 | new RedisGeo(108.57, 34.17, "西安"), 143 | new RedisGeo(121.29, 31.14, "上海"), 144 | new RedisGeo(104.04, 30.40, "成都"), 145 | new RedisGeo(117.12, 39.02, "天津"), 146 | new RedisGeo(91.08, 29.39, "拉萨"), 147 | new RedisGeo(87.36, 43.35, "乌鲁木齐"), 148 | new RedisGeo(102.42, 25.04, "昆明"), 149 | new RedisGeo(120.10, 30.16, "杭州"), 150 | new RedisGeo(106.33, 29.35, "重庆"), 151 | }); 152 | 153 | Console.Write("武汉到广州的距离为:"); 154 | var distance = client.CalculateDistanceBetweenGeoMembers(key, "武汉", "广州", "km"); 155 | Console.WriteLine("{0}公里", distance); 156 | 157 | Console.WriteLine("查找武汉周围1000公里范围内的城市:"); 158 | client.FindGeoMembersInRadius(key, "武汉", 1000, "km").PrintDump(); 159 | 160 | Console.WriteLine("查找武汉周边500公里范围内的城市,并显示距离,且按照距离排序:"); 161 | var geoResults = client.FindGeoResultsInRadius(key, "武汉", 500, "km", sortByNearest: true); 162 | geoResults.Select(i => new 163 | { 164 | i.Member, 165 | Distance = i.Distance + i.Unit 166 | }).ToArray().PrintDump(); 167 | } 168 | } 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /RedisDemo/RedisGenericDemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using RedisDemo.Models; 3 | using RedisDemo.Utils; 4 | using ServiceStack.Text; 5 | 6 | namespace RedisDemo 7 | { 8 | /// 9 | /// 泛型 10 | /// 11 | public class RedisGenericDemo 12 | { 13 | public static void Main1() 14 | { 15 | using (var client = RedisHelper.GetRedisClient()) 16 | { 17 | var typedClient = client.As(); 18 | var article = new ArticleModel 19 | { 20 | Id = 3, 21 | Title = "Demo Article", 22 | Content = "Demo Article Content", 23 | Views = 108, 24 | Favourites = 12 25 | }; 26 | 27 | // String 28 | Console.WriteLine("-----------String------------"); 29 | const string stringKey = "150101:articleString:3"; 30 | typedClient.SetValue(stringKey, article); 31 | Console.WriteLine("{0}的值:{1}{2}", stringKey, Environment.NewLine, typedClient.GetValue(stringKey).Dump()); 32 | 33 | Console.ReadLine(); 34 | 35 | // List 36 | Console.WriteLine("-----------List------------"); 37 | const string listKey = "150101:articleList"; 38 | var redisList = typedClient.Lists[listKey]; 39 | typedClient.AddItemToList(redisList, article); 40 | Console.WriteLine("{0}的所有元素:{1}", listKey, typedClient.GetAllItemsFromList(redisList).Dump()); 41 | 42 | Console.ReadLine(); 43 | 44 | // Hash 45 | Console.WriteLine("-----------Hash------------"); 46 | typedClient.StoreAsHash(article); 47 | typedClient.GetFromHash(article.Id).PrintDump(); 48 | 49 | Console.ReadLine(); 50 | 51 | // Set 52 | Console.WriteLine("-----------Set------------"); 53 | const string setKey = "150101:articleSet"; 54 | var redisSet = typedClient.Sets[setKey]; 55 | typedClient.AddItemToSet(redisSet, article); 56 | typedClient.GetAllItemsFromSet(redisSet).PrintDump(); 57 | 58 | Console.ReadLine(); 59 | 60 | // Sorted Set 61 | Console.WriteLine("-----------Sorted Set------------"); 62 | const string sortedSetKey = "150101:articleSortedSet"; 63 | var redisSortedSet = typedClient.SortedSets[sortedSetKey]; 64 | typedClient.AddItemToSortedSet(redisSortedSet, article, article.Views); 65 | typedClient.GetAllItemsFromSortedSet(redisSortedSet).PrintDump(); 66 | } 67 | 68 | Console.ReadLine(); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RedisDemo/RedisHashDemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using RedisDemo.Models; 3 | using RedisDemo.Utils; 4 | using ServiceStack.Text; 5 | 6 | namespace RedisDemo 7 | { 8 | public class RedisHashDemo 9 | { 10 | public static void Main1(string[] args) 11 | { 12 | Console.WriteLine("-----------------------Hash-------------------------"); 13 | 14 | using (var client = RedisHelper.GetRedisClient()) 15 | { 16 | var article = new ArticleModel 17 | { 18 | Id = 18, 19 | Title = "滴滴出行悄然提价 中国打车市场补贴战或将终结", 20 | Views = 10, 21 | Favourites = 0 22 | }; 23 | const string articleKey = "150101:article:18"; 24 | 25 | // 设置Hash中的多个字段 26 | client.SetRangeInHash(articleKey, article.ToStringDictionary()); 27 | client.GetAllEntriesFromHash(articleKey).PrintDump(); 28 | 29 | // 设置Hash中的单个字段 30 | client.SetEntryInHash(articleKey, "Content", "测试文章内容"); 31 | client.GetAllEntriesFromHash(articleKey).PrintDump(); 32 | 33 | // 对Hash中整数类型的字段做自增操作 34 | client.IncrementValueInHash(articleKey, "Views", 1).Print(); 35 | 36 | client.GetAllEntriesFromHash(articleKey).PrintDump(); 37 | } 38 | 39 | Console.ReadLine(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /RedisDemo/RedisListDemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using RedisDemo.Utils; 4 | using ServiceStack.Redis; 5 | using ServiceStack.Text; 6 | 7 | namespace RedisDemo 8 | { 9 | public class RedisListDemo 10 | { 11 | public static void Main1() 12 | { 13 | Console.WriteLine("--------------------List--------------------"); 14 | 15 | Save(); 16 | 17 | Console.ReadLine(); 18 | 19 | Query(); 20 | 21 | Console.ReadLine(); 22 | 23 | Remove(); 24 | 25 | Console.ReadLine(); 26 | } 27 | 28 | /// 29 | /// 新增,修改 30 | /// 31 | public static void Save() 32 | { 33 | using (var client = RedisHelper.GetRedisClient()) 34 | { 35 | const string namesKey = "150101:savenames"; 36 | 37 | // 单个元素添加到List尾部 38 | client.AddItemToList(namesKey, "Jack"); 39 | Console.WriteLine("单个元素添加在List尾部:"); 40 | client.GetAllItemsFromList(namesKey).PrintDump(); 41 | 42 | // 多个元素添加到List尾部 43 | client.AddRangeToList(namesKey, new List { "Jane", "Jim", "Joe" }); 44 | Console.WriteLine("多个元素添加在List尾部:"); 45 | client.GetAllItemsFromList(namesKey).PrintDump(); 46 | 47 | // 单个元素添加到List头部 48 | client.PrependItemToList(namesKey, "Catherine"); 49 | Console.WriteLine("在起始位置添加单个元素:"); 50 | client.GetAllItemsFromList(namesKey).PrintDump(); 51 | 52 | // 多个元素添加到List头部 53 | client.PrependRangeToList(namesKey, new List { "Tom", "Tim" }); 54 | Console.WriteLine("在起始位置添加多个元素:"); 55 | client.GetAllItemsFromList(namesKey).PrintDump(); 56 | 57 | // 根据指定索引设置元素的值 58 | client.SetItemInList(namesKey, 3, "Chloe"); 59 | Console.WriteLine("修改第4个元素的值:"); 60 | client.GetAllItemsFromList(namesKey).PrintDump(); 61 | } 62 | } 63 | 64 | /// 65 | /// 查询 66 | /// 67 | public static void Query() 68 | { 69 | using (var client = RedisHelper.GetRedisClient()) 70 | { 71 | const string key = "150101:querynames"; 72 | 73 | client.AddRangeToList(key, new List { "Dick", "Evan", "Ada", "Florance", "Jane", "Bob", "Jim", "Joe", "Catherine" }); 74 | client.GetAllItemsFromList(key).PrintDump(); 75 | 76 | Console.WriteLine("List的长度是:{0}", client.GetListCount(key)); 77 | 78 | Console.WriteLine("第5个元素是:{0}", client.GetItemFromList(key, 4)); 79 | 80 | Console.WriteLine("从第4个到第7个元素:"); 81 | client.GetRangeFromList(key, 3, 6).PrintDump(); 82 | 83 | Console.WriteLine("排序之后的第3个到第9个元素:"); 84 | client.GetRangeFromSortedList(key, 2, 8).PrintDump(); 85 | } 86 | } 87 | 88 | /// 89 | /// 删除 90 | /// 91 | public static void Remove() 92 | { 93 | using (var client = RedisHelper.GetRedisClient()) 94 | { 95 | const string key = "150101:removenames"; 96 | client.AddRangeToList(key, new List { "Ada", "Bob", "Catherine", "Dick", "Evan", "Florance", "Jane", "Jim", "Joe" }); 97 | client.GetAllItemsFromList(key).PrintDump(); 98 | 99 | client.RemoveItemFromList(key, "Jane"); 100 | Console.WriteLine("删除'Jane':"); 101 | client.GetAllItemsFromList(key).PrintDump(); 102 | 103 | var startItem = client.RemoveStartFromList(key); 104 | Console.WriteLine("删除起始元素:{0}", startItem); 105 | client.GetAllItemsFromList(key).PrintDump(); 106 | 107 | var endItem = client.RemoveEndFromList(key); 108 | Console.WriteLine("删除末尾元素:{0}", endItem); 109 | client.GetAllItemsFromList(key).PrintDump(); 110 | 111 | Console.WriteLine("删除所有元素"); 112 | client.RemoveAllFromList(key); 113 | client.GetAllItemsFromList(key).PrintDump(); 114 | } 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /RedisDemo/RedisSetDemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using RedisDemo.Utils; 4 | using ServiceStack.Text; 5 | 6 | namespace RedisDemo 7 | { 8 | public class RedisSetDemo 9 | { 10 | public static void Main1() 11 | { 12 | Console.WriteLine("------------------Set--------------------"); 13 | 14 | using (var client = RedisHelper.GetRedisClient()) 15 | { 16 | const string key = "150101:ids"; 17 | 18 | // 添加单个元素 19 | client.AddItemToSet(key, "12"); 20 | client.GetAllItemsFromSet(key).PrintDump(); 21 | 22 | // 添加多个元素 23 | client.AddRangeToSet(key, new List { "14", "16", "15", "17", "12", "13" }); 24 | client.GetAllItemsFromSet(key).PrintDump(); 25 | 26 | Console.WriteLine("Set中是否包含'18':{0}", client.SetContainsItem(key, "18")); 27 | Console.WriteLine("Set中是否包含'16':{0}", client.SetContainsItem(key, "16")); 28 | 29 | Console.WriteLine("从Set中随机获取一个元素:{0}", client.GetRandomItemFromSet(key)); 30 | 31 | Console.WriteLine("从Set中随机移除并返回被移除的这个元素:{0}", client.PopItemFromSet(key)); 32 | 33 | const string key1 = "150101:ids1"; 34 | client.AddRangeToSet(key1, new List { "18", "19", "11", "2", "15" }); 35 | 36 | // 取几个集合的交集 37 | client.GetIntersectFromSets(key, key1).PrintDump(); 38 | // 取几个集合的并集 39 | client.GetUnionFromSets(key, key1).PrintDump(); 40 | } 41 | 42 | Console.ReadLine(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /RedisDemo/RedisSortedSetDemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using RedisDemo.Utils; 4 | using ServiceStack.Text; 5 | 6 | namespace RedisDemo 7 | { 8 | public class RedisSortedSetDemo 9 | { 10 | public static void Main1() 11 | { 12 | Console.WriteLine("-----------------------Sorted Set----------------------"); 13 | 14 | using (var client = RedisHelper.GetRedisClient()) 15 | { 16 | const string key = "150101:students"; 17 | 18 | // 添加单个 19 | client.AddItemToSortedSet(key, "Jack", 96); 20 | client.GetAllItemsFromSortedSet(key).PrintDump(); 21 | 22 | // 添加多个 23 | client.AddRangeToSortedSet(key, new List { "Jane", "Jim", "Tony", "Mary", "Catherine" }, 92); 24 | 25 | // 获取所有元素 26 | Console.WriteLine("获取Sorted Set中的所有元素:"); 27 | client.GetAllItemsFromSortedSet(key).PrintDump(); 28 | 29 | // 获取指定范围内的元素,并且包含元素的score 30 | Console.WriteLine("获取指定范围的元素(包含score):"); 31 | client.GetRangeWithScoresFromSortedSet(key, 1, 8).PrintDump(); 32 | } 33 | 34 | Console.ReadLine(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /RedisDemo/RedisStringDemo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using RedisDemo.Models; 3 | using RedisDemo.Utils; 4 | using ServiceStack.Text; 5 | 6 | namespace RedisDemo 7 | { 8 | public class RedisStringDemo 9 | { 10 | public static void Main(string[] args) 11 | { 12 | Console.WriteLine("-----------------String------------------"); 13 | 14 | using (var client = RedisHelper.GetRedisClient()) 15 | { 16 | // 保存一个字符串 17 | const string key = "150101:name"; 18 | client.SetValue(key, "Jack", TimeSpan.FromMinutes(5)); 19 | Console.WriteLine("{0}的值是:{1}", key, client.GetValue(key)); 20 | 21 | Console.ReadLine(); 22 | 23 | // 保存一个对象 24 | var newPerson = new PersonModel { Id = 1, Name = "Jack", Age = 19, Telephone = "87976562" }; 25 | var personKey = "150101:person:1"; 26 | client.Set(personKey, newPerson, TimeSpan.FromMinutes(5)); 27 | Console.WriteLine("{0}的值是:", personKey); 28 | client.Get(personKey).PrintDump(); 29 | 30 | Console.ReadLine(); 31 | 32 | // 整数自增/自减 33 | const string counterKey = "150101:counter"; 34 | client.SetValue(counterKey, "12"); 35 | 36 | client.IncrementValue(counterKey).Print(); 37 | client.IncrementValueBy(counterKey, 5).Print(); 38 | 39 | client.DecrementValue(counterKey).Print(); 40 | client.DecrementValueBy(counterKey, 12).Print(); 41 | } 42 | 43 | Console.ReadLine(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RedisDemo/Utils/RedisHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration; 3 | using ServiceStack.Redis; 4 | 5 | namespace RedisDemo.Utils 6 | { 7 | public static class RedisHelper 8 | { 9 | private static readonly IRedisClientsManager Manager; 10 | 11 | static RedisHelper() 12 | { 13 | // 读取Redis主机IP配置信息 14 | string[] redisMasterHosts = ConfigurationManager.AppSettings["RedisServerIP"].Split(','); 15 | 16 | // 如果Redis服务器是主从配置,则还需要读取Redis Slave机的IP配置信息 17 | string[] redisSlaveHosts = null; 18 | var slaveConnection = ConfigurationManager.AppSettings["RedisSlaveServerIP"]; 19 | if (!string.IsNullOrWhiteSpace(slaveConnection)) 20 | { 21 | redisSlaveHosts = slaveConnection.Split(','); 22 | } 23 | 24 | // 读取RedisDefaultDb配置 25 | int defaultDb = 0; 26 | string defaultDbSetting = ConfigurationManager.AppSettings["RedisDefaultDb"]; 27 | if (!string.IsNullOrWhiteSpace(defaultDbSetting)) 28 | { 29 | int.TryParse(defaultDbSetting, out defaultDb); 30 | } 31 | 32 | var redisClientManagerConfig = new RedisClientManagerConfig 33 | { 34 | MaxReadPoolSize = 50, 35 | MaxWritePoolSize = 50, 36 | DefaultDb = defaultDb 37 | }; 38 | 39 | // 创建Redis连接池 40 | Manager = new PooledRedisClientManager(redisMasterHosts, redisSlaveHosts, redisClientManagerConfig) 41 | { 42 | PoolTimeout = 2000, 43 | ConnectTimeout = 500 44 | }; 45 | } 46 | 47 | /// 48 | /// 创建Redis连接 49 | /// 50 | /// 51 | public static IRedisClient GetRedisClient() 52 | { 53 | var client = Manager.GetClient(); 54 | return client; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ReferenceDll/FxCommon.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/das2017/07-RedisDemo/d791b2526e71c9f1e6bc75b85f9c922ae93ba009/ReferenceDll/FxCommon.dll -------------------------------------------------------------------------------- /ReferenceDll/Readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/das2017/07-RedisDemo/d791b2526e71c9f1e6bc75b85f9c922ae93ba009/ReferenceDll/Readme.txt -------------------------------------------------------------------------------- /ReferenceDll/Redis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/das2017/07-RedisDemo/d791b2526e71c9f1e6bc75b85f9c922ae93ba009/ReferenceDll/Redis.dll -------------------------------------------------------------------------------- /ReferenceDll/Redis.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redis 5 | 6 | 7 | 8 | 9 | Provides thread-safe retrievel of redis clients since each client is a new one. 10 | Allows the configuration of different ReadWrite and ReadOnly hosts 11 | 12 | 13 | BasicRedisClientManager for ICacheClient 14 | 15 | For more interoperabilty I'm also implementing the ICacheClient on 16 | this cache client manager which has the affect of calling 17 | GetCacheClient() for all write operations and GetReadOnlyCacheClient() 18 | for the read ones. 19 | 20 | This works well for master-slave replication scenarios where you have 21 | 1 master that replicates to multiple read slaves. 22 | 23 | 24 | 25 | 26 | Hosts can be an IP Address or Hostname in the format: host[:port] 27 | e.g. 127.0.0.1:6379 28 | default is: localhost:6379 29 | 30 | The write hosts. 31 | The read hosts. 32 | 33 | 34 | 35 | 36 | Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts 37 | 38 | 39 | 40 | 41 | 42 | Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. 43 | 44 | 45 | 46 | 47 | 48 | Gets or sets object key prefix. 49 | 50 | 51 | 52 | 53 | Resolver strategy for resolving hosts and creating clients 54 | 55 | 56 | 57 | 58 | Courtesy of @marcgravell 59 | http://code.google.com/p/protobuf-net/source/browse/trunk/protobuf-net/BufferPool.cs 60 | 61 | 62 | 63 | 64 | A complete redis command, with method to send command, receive response, and run callback on success or failure 65 | 66 | 67 | 68 | 69 | Wrap the common redis set operations under a ICollection[string] interface. 70 | 71 | 72 | 73 | 74 | Wrap the common redis set operations under a ICollection[string] interface. 75 | 76 | 77 | 78 | 79 | Wrap the common redis set operations under a ICollection[string] interface. 80 | 81 | 82 | 83 | 84 | Allows you to get Redis value operations to operate against POCO types. 85 | 86 | 87 | 88 | 89 | 90 | Use this to share the same redis connection with another 91 | 92 | The client. 93 | 94 | 95 | 96 | Queue of commands for redis typed client 97 | 98 | 99 | 100 | 101 | 102 | Redis operation (transaction/pipeline) that allows queued commands to be completed 103 | 104 | 105 | 106 | 107 | Pipeline for redis typed client 108 | 109 | 110 | 111 | 112 | 113 | Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations). 114 | 115 | 116 | 117 | 118 | Put "QUEUED" messages at back of queue 119 | 120 | 121 | 122 | 123 | 124 | Issue exec command (not queued) 125 | 126 | 127 | 128 | 129 | callback for after result count is read in 130 | 131 | 132 | 133 | 134 | 135 | A complete redis command, with method to send command, receive response, and run callback on success or failure 136 | 137 | 138 | 139 | 140 | Redis command that does not get queued 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | General purpose pipeline 150 | 151 | 152 | 153 | 154 | 155 | Flush send buffer, and read responses 156 | 157 | 158 | 159 | 160 | Provides thread-safe pooling of redis client connections. 161 | Allows load-balancing of master-write and read-slave hosts, ideal for 162 | 1 master and multiple replicated read slaves. 163 | 164 | 165 | 166 | 167 | Hosts can be an IP Address or Hostname in the format: host[:port] 168 | e.g. 127.0.0.1:6379 169 | default is: localhost:6379 170 | 171 | The write hosts. 172 | The read hosts. 173 | The config. 174 | 175 | 176 | 177 | Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts 178 | 179 | 180 | 181 | 182 | 183 | Called within a lock 184 | 185 | 186 | 187 | 188 | 189 | Returns a ReadOnly client using the hosts defined in ReadOnlyHosts. 190 | 191 | 192 | 193 | 194 | 195 | Called within a lock 196 | 197 | 198 | 199 | 200 | 201 | Disposes the read only client. 202 | 203 | The client. 204 | 205 | 206 | 207 | Disposes the write client. 208 | 209 | The client. 210 | 211 | 212 | 213 | Gets or sets object key prefix. 214 | 215 | 216 | 217 | 218 | The client wraps the native redis operations into a more readable c# API. 219 | 220 | Where possible these operations are also exposed in common c# interfaces, 221 | e.g. RedisClient.Lists => IList[string] 222 | RedisClient.Sets => ICollection[string] 223 | 224 | 225 | 226 | 227 | This class contains all the common operations for the RedisClient. 228 | The client contains a 1:1 mapping of c# methods to redis operations of the same name. 229 | 230 | Not threadsafe use a pooled manager 231 | 232 | 233 | 234 | 235 | Used to manage connection pooling 236 | 237 | 238 | 239 | 240 | Requires custom result parsing 241 | 242 | Number of results 243 | 244 | 245 | 246 | Command to set multuple binary safe arguments 247 | 248 | 249 | 250 | 251 | 252 | 253 | Send command outside of managed Write Buffer 254 | 255 | 256 | 257 | 258 | 259 | reset buffer index in send buffer 260 | 261 | 262 | 263 | 264 | Gets or sets object key prefix. 265 | 266 | 267 | 268 | 269 | Creates a new instance of the Redis Client from NewFactoryFn. 270 | 271 | 272 | 273 | 274 | Store object fields as a dictionary of values in a Hash value. 275 | Conversion to Dictionary can be customized with RedisClient.ConvertToHashFn 276 | 277 | 278 | 279 | 280 | Returns key with automatic object id detection in provided value with generic type. 281 | 282 | 283 | 284 | 285 | 286 | 287 | Returns key with explicit object id. 288 | 289 | 290 | 291 | 292 | 293 | 294 | Returns key with explicit object type and id. 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | Manage a client acquired from the PooledRedisClientManager 303 | Dispose method will release the client back to the pool. 304 | 305 | 306 | 307 | 308 | wrap the acquired client 309 | 310 | 311 | 312 | 313 | 314 | release the wrapped client back to the pool 315 | 316 | 317 | 318 | 319 | access the wrapped client 320 | 321 | 322 | 323 | 324 | Wrap the common redis set operations under a ICollection[string] interface. 325 | 326 | 327 | 328 | 329 | Wrap the common redis list operations under a IList[string] interface. 330 | 331 | 332 | 333 | 334 | For interoperabilty GetCacheClient() and GetReadOnlyCacheClient() 335 | return an ICacheClient wrapper around the redis manager which has the affect of calling 336 | GetClient() for all write operations and GetReadOnlyClient() for the read ones. 337 | 338 | This works well for master-slave replication scenarios where you have 339 | 1 master that replicates to multiple read slaves. 340 | 341 | 342 | 343 | 344 | Ignore dispose on RedisClientsManager, which should be registered as a singleton 345 | 346 | 347 | 348 | 349 | Wrap the common redis set operations under a ICollection[string] interface. 350 | 351 | 352 | 353 | 354 | Useful wrapper IRedisClientsManager to cut down the boiler plate of most IRedisClient access 355 | 356 | 357 | 358 | 359 | Creates a PubSubServer that uses a background thread to listen and process for 360 | Redis Pub/Sub messages published to the specified channel. 361 | Use optional callbacks to listen for message, error and life-cycle events. 362 | Callbacks can be assigned later, then call Start() for PubSubServer to start listening for messages 363 | 364 | 365 | 366 | 367 | Wrap the common redis set operations under a ICollection[string] interface. 368 | 369 | 370 | 371 | 372 | Factory used to Create `RedisClient` instances 373 | 374 | 375 | 376 | 377 | The default RedisClient Socket ConnectTimeout (default -1, None) 378 | 379 | 380 | 381 | 382 | The default RedisClient Socket SendTimeout (default -1, None) 383 | 384 | 385 | 386 | 387 | The default RedisClient Socket ReceiveTimeout (default -1, None) 388 | 389 | 390 | 391 | 392 | Default Idle TimeOut before a connection is considered to be stale (default 240 secs) 393 | 394 | 395 | 396 | 397 | The default RetryTimeout for auto retry of failed operations (default 3000ms) 398 | 399 | 400 | 401 | 402 | Default Max Pool Size for Pooled Redis Client Managers (default none) 403 | 404 | 405 | 406 | 407 | The BackOff multiplier failed Auto Retries starts from (default 10ms) 408 | 409 | 410 | 411 | 412 | The Byte Buffer Size to combine Redis Operations within (default 1450 bytes) 413 | 414 | 415 | 416 | 417 | The Byte Buffer Size for Operations to use a byte buffer pool (default 500kb) 418 | 419 | 420 | 421 | 422 | Whether Connections to Master hosts should be verified they're still master instances (default true) 423 | 424 | 425 | 426 | 427 | The ConnectTimeout on clients used to find the next available host (default 200ms) 428 | 429 | 430 | 431 | 432 | Skip ServerVersion Checks by specifying Min Version number, e.g: 2.8.12 => 2812, 2.9.1 => 2910 433 | 434 | 435 | 436 | 437 | How long to hold deactivated clients for before disposing their connection (default 1 min) 438 | Dispose of deactivated Clients immediately with TimeSpan.Zero 439 | 440 | 441 | 442 | 443 | Whether Debug Logging should log detailed Redis operations (default false) 444 | 445 | 446 | 447 | 448 | Resets Redis Config and Redis Stats back to default values 449 | 450 | 451 | 452 | 453 | Redis-specific exception. Thrown if unable to connect to Redis server due to socket exception, for example. 454 | 455 | 456 | 457 | 458 | Provides thread-safe pooling of redis client connections. 459 | 460 | 461 | 462 | 463 | Returns a Read/Write client (The default) using the hosts defined in ReadWriteHosts 464 | 465 | 466 | 467 | 468 | 469 | Called within a lock 470 | 471 | 472 | 473 | 474 | 475 | Disposes the write client. 476 | 477 | The client. 478 | 479 | 480 | 481 | Initialize Sentinel Subscription and Configure Redis ClientsManager 482 | 483 | 484 | 485 | 486 | Check if GetValidSentinel should try the next sentinel server 487 | 488 | 489 | This will be true if the failures is less than either RedisSentinel.MaxFailures or the # of sentinels, whatever is greater 490 | 491 | 492 | 493 | Change to use a different IRedisClientsManager 494 | 495 | 496 | 497 | 498 | Configure the Redis Connection String to use for a Redis Client Host 499 | 500 | 501 | 502 | 503 | The configured Redis Client Manager this Sentinel managers 504 | 505 | 506 | 507 | 508 | Fired when Sentinel fails over the Redis Client Manager to a new master 509 | 510 | 511 | 512 | 513 | Fired when the Redis Sentinel Worker connection fails 514 | 515 | 516 | 517 | 518 | Fired when the Sentinel worker receives a message from the Sentinel Subscription 519 | 520 | 521 | 522 | 523 | Map the internal IP's returned by Sentinels to its external IP 524 | 525 | 526 | 527 | 528 | Whether to routinely scan for other sentinel hosts (default true) 529 | 530 | 531 | 532 | 533 | What interval to scan for other sentinel hosts (default 10 mins) 534 | 535 | 536 | 537 | 538 | How long to wait after failing before connecting to next redis instance (default 250ms) 539 | 540 | 541 | 542 | 543 | How long to retry connecting to hosts before throwing (default 60 secs) 544 | 545 | 546 | 547 | 548 | How long to wait after consecutive failed connection attempts to master before forcing 549 | a Sentinel to failover the current master (default 60 secs) 550 | 551 | 552 | 553 | 554 | The Max Connection time for Sentinel Worker (default 100ms) 555 | 556 | 557 | 558 | 559 | The Max TCP Socket Receive time for Sentinel Worker (default 100ms) 560 | 561 | 562 | 563 | 564 | The Max TCP Socket Send time for Sentinel Worker (default 100ms) 565 | 566 | 567 | 568 | 569 | Reset client connections when Sentinel reports redis instance is subjectively down (default true) 570 | 571 | 572 | 573 | 574 | Reset client connections when Sentinel reports redis instance is objectively down (default true) 575 | 576 | 577 | 578 | 579 | Event that is fired when the sentinel subscription raises an event 580 | 581 | 582 | 583 | 584 | 585 | 586 | Don't immediately kill connections of active clients after failover to give them a chance to dispose gracefully. 587 | Deactivating clients are automatically cleared from the pool. 588 | 589 | 590 | 591 | 592 | Total number of commands sent 593 | 594 | 595 | 596 | 597 | Number of times the Redis Client Managers have FailoverTo() either by sentinel or manually 598 | 599 | 600 | 601 | 602 | Number of times a Client was deactivated from the pool, either by FailoverTo() or exceptions on client 603 | 604 | 605 | 606 | 607 | Number of times connecting to a Sentinel has failed 608 | 609 | 610 | 611 | 612 | Number of times we've forced Sentinel to failover to another master due to 613 | consecutive errors beyond sentinel.WaitBeforeForcingMasterFailover 614 | 615 | 616 | 617 | 618 | Number of times a connecting to a reported Master wasn't actually a Master 619 | 620 | 621 | 622 | 623 | Number of times no Masters could be found in any of the configured hosts 624 | 625 | 626 | 627 | 628 | Number of Redis Client instances created with RedisConfig.ClientFactory 629 | 630 | 631 | 632 | 633 | Number of times a Redis Client was created outside of pool, either due to overflow or reserved slot was overridden 634 | 635 | 636 | 637 | 638 | Number of times Redis Sentinel reported a Subjective Down (sdown) 639 | 640 | 641 | 642 | 643 | Number of times Redis Sentinel reported an Objective Down (sdown) 644 | 645 | 646 | 647 | 648 | Number of times a Redis Request was retried due to Socket or Retryable exception 649 | 650 | 651 | 652 | 653 | Number of times a Request succeeded after it was retried 654 | 655 | 656 | 657 | 658 | Number of times a Retry Request failed after exceeding RetryTimeout 659 | 660 | 661 | 662 | 663 | Total number of deactivated clients that are pending being disposed 664 | 665 | 666 | 667 | 668 | Provides a redis connection pool that can be sharded 669 | 670 | 671 | 672 | 673 | logical name 674 | 675 | 676 | 677 | 678 | An arbitrary weight relative to other nodes 679 | 680 | 681 | 682 | logical name 683 | An arbitrary weight relative to other nodes 684 | redis nodes 685 | 686 | 687 | 688 | Provides sharding of redis client connections. 689 | uses consistent hashing to distribute keys across connection pools 690 | 691 | 692 | 693 | 694 | maps a key to a redis connection pool 695 | 696 | key to map 697 | a redis connection pool 698 | 699 | 700 | 701 | Adds a node and maps points across the circle 702 | 703 | node to add 704 | An arbitrary number, specifies how often it occurs relative to other targets. 705 | 706 | 707 | 708 | A variation of Binary Search algorithm. Given a number, matches the next highest number from the sorted array. 709 | If a higher number does not exist, then the first number in the array is returned. 710 | 711 | a sorted array to perform the search 712 | number to find the next highest number against 713 | next highest number 714 | 715 | 716 | 717 | Given a key, generates an unsigned 64 bit hash code using MD5 718 | 719 | 720 | 721 | 722 | 723 | 724 | Provides access to the method reflection data as part of the before/after event 725 | 726 | 727 | 728 | 729 | Stores details about the context in which an IRedisClient is allocated. 730 | 731 | 732 | 733 | 734 | 735 | Tracks each IRedisClient instance allocated from the IRedisClientsManager logging when they are allocated and disposed. 736 | Periodically writes the allocated instances to the log for diagnostic purposes. 737 | 738 | 739 | 740 | 741 | Represents a generic collection of key/value pairs that are ordered independently of the key and value. 742 | 743 | The type of the keys in the dictionary 744 | The type of the values in the dictionary 745 | 746 | 747 | 748 | Adds an entry with the specified key and value into the IOrderedDictionary<TKey,TValue> collection with the lowest available index. 749 | 750 | The key of the entry to add. 751 | The value of the entry to add. 752 | The index of the newly added entry 753 | 754 | You can also use the property to add new elements by setting the value of a key that does not exist in the IOrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the IOrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. 755 | An element with the same key already exists in the IOrderedDictionary<TKey,TValue> 756 | The IOrderedDictionary<TKey,TValue> is read-only.
757 | -or-
758 | The IOrderedDictionary<TKey,TValue> has a fized size.
759 |
760 | 761 | 762 | Inserts a new entry into the IOrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. 763 | 764 | The zero-based index at which the element should be inserted. 765 | The key of the entry to add. 766 | The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. 767 | is less than 0.
768 | -or-
769 | is greater than .
770 | An element with the same key already exists in the IOrderedDictionary<TKey,TValue>. 771 | The IOrderedDictionary<TKey,TValue> is read-only.
772 | -or-
773 | The IOrderedDictionary<TKey,TValue> has a fized size.
774 |
775 | 776 | 777 | Gets or sets the value at the specified index. 778 | 779 | The zero-based index of the value to get or set. 780 | The value of the item at the specified index. 781 | is less than 0.
782 | -or-
783 | is equal to or greater than .
784 |
785 | 786 | 787 | distributed lock class that follows the Resource Allocation Is Initialization pattern 788 | 789 | 790 | 791 | 792 | Lock 793 | 794 | 795 | 796 | in seconds 797 | in seconds 798 | 799 | 800 | 801 | unlock 802 | 803 | 804 | 805 | 806 | Distributed lock interface 807 | 808 | 809 | 810 | 811 | acquire distributed, non-reentrant lock on key 812 | 813 | global key for this lock 814 | timeout for acquiring lock 815 | timeout for lock, in seconds (stored as value against lock key) 816 | 817 | 818 | 819 | 820 | 821 | unlock key 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | Locking strategy interface 835 | 836 | 837 | 838 | 839 | This class manages a read lock for a local readers/writer lock, 840 | using the Resource Acquisition Is Initialization pattern 841 | 842 | 843 | 844 | 845 | RAII initialization 846 | 847 | 848 | 849 | 850 | 851 | RAII disposal 852 | 853 | 854 | 855 | 856 | This class manages a write lock for a local readers/writer lock, 857 | using the Resource Acquisition Is Initialization pattern 858 | 859 | 860 | 861 | 862 | 863 | RAII disposal 864 | 865 | 866 | 867 | 868 | serialize/deserialize arbitrary objects 869 | (objects must be serializable) 870 | 871 | 872 | 873 | 874 | Serialize object to buffer 875 | 876 | serializable object 877 | 878 | 879 | 880 | 881 | Deserialize buffer to object 882 | 883 | byte array to deserialize 884 | 885 | 886 | 887 | 888 | Optimized implementation. Primitive types are manually serialized, the rest are serialized using binary serializer />. 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | serialize value and wrap with 908 | 909 | 910 | 911 | 912 | 913 | 914 | Unwrap object wrapped in 915 | 916 | 917 | 918 | 919 | 920 | 921 | Represents a generic collection of key/value pairs that are ordered independently of the key and value. 922 | 923 | The type of the keys in the dictionary 924 | The type of the values in the dictionary 925 | 926 | 927 | 928 | Initializes a new instance of the OrderedDictionary<TKey,TValue> class. 929 | 930 | 931 | 932 | 933 | Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity. 934 | 935 | The initial number of elements that the OrderedDictionary<TKey,TValue> can contain. 936 | is less than 0 937 | 938 | 939 | 940 | Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified comparer. 941 | 942 | The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. 943 | 944 | 945 | 946 | Initializes a new instance of the OrderedDictionary<TKey,TValue> class using the specified initial capacity and comparer. 947 | 948 | The initial number of elements that the OrderedDictionary<TKey,TValue> collection can contain. 949 | The IEqualityComparer<TKey> to use when comparing keys, or to use the default EqualityComparer<TKey> for the type of the key. 950 | is less than 0 951 | 952 | 953 | 954 | Converts the object passed as a key to the key type of the dictionary 955 | 956 | The key object to check 957 | The key object, cast as the key type of the dictionary 958 | is . 959 | The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . 960 | 961 | 962 | 963 | Converts the object passed as a value to the value type of the dictionary 964 | 965 | The object to convert to the value type of the dictionary 966 | The value object, converted to the value type of the dictionary 967 | is , and the value type of the OrderedDictionary<TKey,TValue> is a value type. 968 | The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . 969 | 970 | 971 | 972 | Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. 973 | 974 | The zero-based index at which the element should be inserted. 975 | The key of the entry to add. 976 | The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. 977 | is less than 0.
978 | -or-
979 | is greater than .
980 | is . 981 | An element with the same key already exists in the OrderedDictionary<TKey,TValue>. 982 |
983 | 984 | 985 | Inserts a new entry into the OrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. 986 | 987 | The zero-based index at which the element should be inserted. 988 | The key of the entry to add. 989 | The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. 990 | is less than 0.
991 | -or-
992 | is greater than .
993 | is .
994 | -or-
995 | is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
996 | The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
997 | -or-
998 | The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
999 | -or-
1000 | An element with the same key already exists in the OrderedDictionary<TKey,TValue>.
1001 |
1002 | 1003 | 1004 | Removes the entry at the specified index from the OrderedDictionary<TKey,TValue> collection. 1005 | 1006 | The zero-based index of the entry to remove. 1007 | is less than 0.
1008 | -or-
1009 | index is equal to or greater than .
1010 |
1011 | 1012 | 1013 | Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. 1014 | 1015 | The key of the entry to add. 1016 | The value of the entry to add. This value can be . 1017 | A key cannot be , but a value can be. 1018 | You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. 1019 | is 1020 | An element with the same key already exists in the OrderedDictionary<TKey,TValue> 1021 | 1022 | 1023 | 1024 | Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. 1025 | 1026 | The key of the entry to add. 1027 | The value of the entry to add. This value can be . 1028 | The index of the newly added entry 1029 | A key cannot be , but a value can be. 1030 | You can also use the property to add new elements by setting the value of a key that does not exist in the OrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the OrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. 1031 | is 1032 | An element with the same key already exists in the OrderedDictionary<TKey,TValue> 1033 | 1034 | 1035 | 1036 | Adds an entry with the specified key and value into the OrderedDictionary<TKey,TValue> collection with the lowest available index. 1037 | 1038 | The key of the entry to add. 1039 | The value of the entry to add. This value can be . 1040 | is .
1041 | -or-
1042 | is , and the value type of the OrderedDictionary<TKey,TValue> is a value type.
1043 | The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
1044 | -or-
1045 | The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of .
1046 |
1047 | 1048 | 1049 | Removes all elements from the OrderedDictionary<TKey,TValue> collection. 1050 | 1051 | The capacity is not changed as a result of calling this method. 1052 | 1053 | 1054 | 1055 | Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. 1056 | 1057 | The key to locate in the OrderedDictionary<TKey,TValue> collection. 1058 | if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . 1059 | is 1060 | 1061 | 1062 | 1063 | Determines whether the OrderedDictionary<TKey,TValue> collection contains a specific key. 1064 | 1065 | The key to locate in the OrderedDictionary<TKey,TValue> collection. 1066 | if the OrderedDictionary<TKey,TValue> collection contains an element with the specified key; otherwise, . 1067 | is 1068 | The key type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . 1069 | 1070 | 1071 | 1072 | Returns the zero-based index of the specified key in the OrderedDictionary<TKey,TValue> 1073 | 1074 | The key to locate in the OrderedDictionary<TKey,TValue> 1075 | The zero-based index of , if is found in the OrderedDictionary<TKey,TValue>; otherwise, -1 1076 | This method performs a linear search; therefore it has a cost of O(n) at worst. 1077 | 1078 | 1079 | 1080 | Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. 1081 | 1082 | The key of the entry to remove 1083 | if the key was found and the corresponding element was removed; otherwise, 1084 | 1085 | 1086 | 1087 | Removes the entry with the specified key from the OrderedDictionary<TKey,TValue> collection. 1088 | 1089 | The key of the entry to remove 1090 | 1091 | 1092 | 1093 | Copies the elements of the OrderedDictionary<TKey,TValue> elements to a one-dimensional Array object at the specified index. 1094 | 1095 | The one-dimensional object that is the destination of the objects copied from the OrderedDictionary<TKey,TValue>. The must have zero-based indexing. 1096 | The zero-based index in at which copying begins. 1097 | The method preserves the order of the elements in the OrderedDictionary<TKey,TValue> 1098 | 1099 | 1100 | 1101 | Gets the value associated with the specified key. 1102 | 1103 | The key of the value to get. 1104 | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of . This parameter can be passed uninitialized. 1105 | if the OrderedDictionary<TKey,TValue> contains an element with the specified key; otherwise, . 1106 | 1107 | 1108 | 1109 | Adds the specified value to the OrderedDictionary<TKey,TValue> with the specified key. 1110 | 1111 | The KeyValuePair<TKey,TValue> structure representing the key and value to add to the OrderedDictionary<TKey,TValue>. 1112 | 1113 | 1114 | 1115 | Determines whether the OrderedDictionary<TKey,TValue> contains a specific key and value. 1116 | 1117 | The KeyValuePair<TKey,TValue> structure to locate in the OrderedDictionary<TKey,TValue>. 1118 | if is found in the OrderedDictionary<TKey,TValue>; otherwise, . 1119 | 1120 | 1121 | 1122 | Copies the elements of the OrderedDictionary<TKey,TValue> to an array of type , starting at the specified index. 1123 | 1124 | The one-dimensional array of type KeyValuePair<TKey,TValue> that is the destination of the KeyValuePair<TKey,TValue> elements copied from the OrderedDictionary<TKey,TValue>. The array must have zero-based indexing. 1125 | The zero-based index in at which copying begins. 1126 | 1127 | 1128 | 1129 | Removes a key and value from the dictionary. 1130 | 1131 | The KeyValuePair<TKey,TValue> structure representing the key and value to remove from the OrderedDictionary<TKey,TValue>. 1132 | if the key and value represented by is successfully found and removed; otherwise, . This method returns if is not found in the OrderedDictionary<TKey,TValue>. 1133 | 1134 | 1135 | 1136 | Gets the dictionary object that stores the keys and values 1137 | 1138 | The dictionary object that stores the keys and values for the OrderedDictionary<TKey,TValue> 1139 | Accessing this property will create the dictionary object if necessary 1140 | 1141 | 1142 | 1143 | Gets the list object that stores the key/value pairs. 1144 | 1145 | The list object that stores the key/value pairs for the OrderedDictionary<TKey,TValue> 1146 | Accessing this property will create the list object if necessary. 1147 | 1148 | 1149 | 1150 | Gets or sets the value at the specified index. 1151 | 1152 | The zero-based index of the value to get or set. 1153 | The value of the item at the specified index. 1154 | is less than 0.
1155 | -or-
1156 | index is equal to or greater than .
1157 |
1158 | 1159 | 1160 | Gets or sets the value at the specified index. 1161 | 1162 | The zero-based index of the value to get or set. 1163 | The value of the item at the specified index. 1164 | is less than 0.
1165 | -or-
1166 | index is equal to or greater than .
1167 | is a null reference, and the value type of the OrderedDictionary<TKey,TValue> is a value type. 1168 | The value type of the OrderedDictionary<TKey,TValue> is not in the inheritance hierarchy of . 1169 |
1170 | 1171 | 1172 | Gets a value indicating whether the OrderedDictionary<TKey,TValue> has a fixed size. 1173 | 1174 | if the OrderedDictionary<TKey,TValue> has a fixed size; otherwise, . The default is . 1175 | 1176 | 1177 | 1178 | Gets a value indicating whether the OrderedDictionary<TKey,TValue> collection is read-only. 1179 | 1180 | if the OrderedDictionary<TKey,TValue> is read-only; otherwise, . The default is . 1181 | 1182 | A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created. 1183 | A collection that is read-only is simply a collection with a wrapper that prevents modification of the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes. 1184 | 1185 | 1186 | 1187 | 1188 | Gets an object containing the keys in the OrderedDictionary<TKey,TValue>. 1189 | 1190 | An object containing the keys in the OrderedDictionary<TKey,TValue>. 1191 | The returned object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. 1192 | 1193 | 1194 | 1195 | Gets an object containing the values in the OrderedDictionary<TKey,TValue> collection. 1196 | 1197 | An object containing the values in the OrderedDictionary<TKey,TValue> collection. 1198 | The returned object is not a static copy; instead, the refers back to the values in the original OrderedDictionary<TKey,TValue> collection. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the . 1199 | 1200 | 1201 | 1202 | Gets or sets the value with the specified key. 1203 | 1204 | The key of the value to get or set. 1205 | The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. 1206 | 1207 | 1208 | 1209 | Gets or sets the value with the specified key. 1210 | 1211 | The key of the value to get or set. 1212 | The value associated with the specified key. If the specified key is not found, attempting to get it returns , and attempting to set it creates a new element using the specified key. 1213 | 1214 | 1215 | 1216 | Gets the number of key/values pairs contained in the OrderedDictionary<TKey,TValue> collection. 1217 | 1218 | The number of key/value pairs contained in the OrderedDictionary<TKey,TValue> collection. 1219 | 1220 | 1221 | 1222 | Gets a value indicating whether access to the OrderedDictionary<TKey,TValue> object is synchronized (thread-safe). 1223 | 1224 | This method always returns false. 1225 | 1226 | 1227 | 1228 | Gets an object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. 1229 | 1230 | An object that can be used to synchronize access to the OrderedDictionary<TKey,TValue> object. 1231 | 1232 | 1233 | 1234 | Gets an ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. 1235 | 1236 | An ICollection<TKey> object containing the keys in the OrderedDictionary<TKey,TValue>. 1237 | The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the keys in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the key collection. 1238 | 1239 | 1240 | 1241 | Gets an ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. 1242 | 1243 | An ICollection<TValue> object containing the values in the OrderedDictionary<TKey,TValue>. 1244 | The returned ICollection<TKey> object is not a static copy; instead, the collection refers back to the values in the original OrderedDictionary<TKey,TValue>. Therefore, changes to the OrderedDictionary<TKey,TValue> continue to be reflected in the value collection. 1245 | 1246 | 1247 | 1248 | distributed work item queue. Messages are processed in chronological order 1249 | 1250 | 1251 | 1252 | 1253 | distributed work item queue 1254 | 1255 | 1256 | 1257 | 1258 | Enqueue incoming messages 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | Dequeue next batch of work items 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | distributed work item queue. Each message must have an associated 1276 | work item id. For a given id, all work items are guaranteed to be processed 1277 | in the order in which they are received. 1278 | 1279 | 1280 | 1281 | 1282 | distributed work item queue. Each message must have an associated 1283 | work item id. For a given id, all work items are guaranteed to be processed 1284 | in the order in which they are received. 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | Enqueue item in priority queue corresponding to workItemId identifier 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | Preprare next work item id for dequeueing 1299 | 1300 | 1301 | 1302 | 1303 | Dequeue up to maxBatchSize items from queue corresponding to workItemId identifier. 1304 | Once this method is called, or will not 1305 | return any items for workItemId until the dequeue lock returned is unlocked. 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | Replace existing work item in workItemId queue 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | Queue incoming messages 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | Must call this periodically to move work items from priority queue to pending queue 1329 | 1330 | 1331 | 1332 | 1333 | Replace existing work item in workItemId queue 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | Pop items from list 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | Force release of locks held by crashed servers 1349 | 1350 | 1351 | 1352 | 1353 | release lock held by crashed server 1354 | 1355 | 1356 | 1357 | true if lock is released, either by this method or by another client; false otherwise 1358 | 1359 | 1360 | 1361 | Unlock work item id, so other servers can process items for this id 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | simple distributed work item queue 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | Enqueue item 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | Dequeue up to maxBatchSize items from queue 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | Queue incoming messages 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | Dequeue next batch of work items for processing. After this method is called, 1415 | no other work items with same id will be available for 1416 | dequeuing until PostDequeue is called 1417 | 1418 | KeyValuePair: key is work item id, and value is list of dequeued items. 1419 | 1420 | 1421 | 1422 | 1423 | pop numProcessed items from queue and unlock queue for work item id that dequeued 1424 | items are associated with 1425 | 1426 | 1427 | 1428 | 1429 | 1430 | A dequeued work item has been processed. When all of the dequeued items have been processed, 1431 | all items will be popped from the queue,and the queue unlocked for the work item id that 1432 | the dequeued items are associated with 1433 | 1434 | 1435 | 1436 | 1437 | Update first unprocessed item with new work item. 1438 | 1439 | 1440 | 1441 | 1442 | 1443 | 1444 | 1445 | 1446 | 1447 | 1448 | pop remaining items that were returned by dequeue, and unlock queue 1449 | 1450 | 1451 | 1452 | 1453 | 1454 | indicate that an item has been processed by the caller 1455 | 1456 | 1457 | 1458 | 1459 | Update first unprocessed work item 1460 | 1461 | 1462 | 1463 | 1464 | 1465 | Serialize object to buffer 1466 | 1467 | serializable object 1468 | 1469 | 1470 | 1471 | 1472 | 1473 | 1474 | array of serializable objects 1475 | 1476 | 1477 | 1478 | 1479 | Deserialize buffer to object 1480 | 1481 | byte array to deserialize 1482 | 1483 | 1484 | 1485 | 1486 | 1487 | customize the client serializer 1488 | 1489 | 1490 | 1491 | 1492 | manages a "region" in the redis key space 1493 | namespace can be cleared by incrementing the generation 1494 | 1495 | 1496 | 1497 | 1498 | get current generation 1499 | 1500 | 1501 | 1502 | 1503 | 1504 | set new generation 1505 | 1506 | 1507 | 1508 | 1509 | 1510 | redis key for generation 1511 | 1512 | 1513 | 1514 | 1515 | 1516 | get redis key that holds all namespace keys 1517 | 1518 | 1519 | 1520 | 1521 | 1522 | get global cache key 1523 | 1524 | 1525 | 1526 | 1527 | 1528 | 1529 | get global key inside of this namespace 1530 | 1531 | 1532 | prefixes can be added for name deconfliction 1533 | 1534 | 1535 | 1536 | 1537 | replace UniqueCharacter with its double, to avoid name clash 1538 | 1539 | 1540 | 1541 | 1542 | 1543 | 1544 | 1545 | 1546 | 1547 | 1548 | 1549 | 1550 | 1551 | get locking strategy 1552 | 1553 | 1554 | 1555 | 1556 | wraps a serialized representation of an object 1557 | 1558 | 1559 | 1560 | 1561 | 1562 | Initializes a new instance of . 1563 | 1564 | Custom item data. 1565 | The serialized item. 1566 | 1567 | 1568 | 1569 | The data representing the item being stored/retireved. 1570 | 1571 | 1572 | 1573 | 1574 | Flags set for this instance. 1575 | 1576 | 1577 | 1578 | 1579 | Adds support for Redis Transactions (i.e. MULTI/EXEC/DISCARD operations). 1580 | 1581 | 1582 | 1583 | 1584 | Put "QUEUED" messages at back of queue 1585 | 1586 | 1587 | 1588 | 1589 | 1590 | Issue exec command (not queued) 1591 | 1592 | 1593 | 1594 | 1595 | callback for after result count is read in 1596 | 1597 | 1598 | 1599 |
1600 |
1601 | --------------------------------------------------------------------------------