-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
369 lines (202 loc) · 29 KB
/
Copy pathatom.xml
File metadata and controls
369 lines (202 loc) · 29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>张小一的博客</title>
<subtitle>胆小认生,不易相处</subtitle>
<link href="/atom.xml" rel="self"/>
<link href="http://yoursite.com/"/>
<updated>2018-04-23T00:23:56.317Z</updated>
<id>http://yoursite.com/</id>
<author>
<name>非专业程序员</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>HTML Entities</title>
<link href="http://yoursite.com/2018/04/23/HTML-Entities/"/>
<id>http://yoursite.com/2018/04/23/HTML-Entities/</id>
<published>2018-04-23T00:18:06.000Z</published>
<updated>2018-04-23T00:23:56.317Z</updated>
<content type="html"><![CDATA[<h2 id="Some-Useful"><a href="#Some-Useful" class="headerlink" title="Some Useful"></a>Some Useful</h2><p>Result| Description| Entity Name| Entity Number<br> |non-breaking space| |  <br><| less than| <| <</p><blockquote><p>| greater than| >| ><br>&| ampersand| &| &<br>¢| cent| ¢| ¢<br>£| pound| £| £<br>¥| yen| ¥| ¥<br>€| euro| €| €<br>©| copyright| ©| ©<br>®| registered trademark| ®| ®</p></blockquote><h2 id="Combining-Diacritical-Marks"><a href="#Combining-Diacritical-Marks" class="headerlink" title="Combining Diacritical Marks"></a>Combining Diacritical Marks</h2><p>Mark| Character| Construct| Result<br> ̀| a| à| à<br> ́| a| á| á<br> ̂| a| â| â<br> ̃| a| ã| ã<br> ̀| O| Ò| Ò<br> ́| O| Ó| Ó<br> ̂| O| Ô| Ô<br> ̃| O| Õ| Õ</p>]]></content>
<summary type="html">
<h2 id="Some-Useful"><a href="#Some-Useful" class="headerlink" title="Some Useful"></a>Some Useful</h2><p>Result| Description| Entity
</summary>
<category term="前端" scheme="http://yoursite.com/categories/%E5%89%8D%E7%AB%AF/"/>
<category term="html" scheme="http://yoursite.com/tags/html/"/>
</entry>
<entry>
<title>webpack</title>
<link href="http://yoursite.com/2018/04/22/webpack/"/>
<id>http://yoursite.com/2018/04/22/webpack/</id>
<published>2018-04-22T04:14:57.000Z</published>
<updated>2018-04-22T04:42:42.000Z</updated>
<content type="html"><![CDATA[<h2 id="前提"><a href="#前提" class="headerlink" title="前提"></a>前提</h2><blockquote><p>nodejs</p></blockquote><blockquote><p>npm or yarn</p></blockquote><h2 id="初始化"><a href="#初始化" class="headerlink" title="初始化"></a>初始化</h2><blockquote><p>mkdir project && cd project</p></blockquote><blockquote><p>yarn init -y</p></blockquote><blockquote><p>yarn add webpack webpack-cli</p></blockquote><blockquote><p>添加webpack配置文件</p></blockquote><blockquote><p>修改package.json 文件,添加脚本</p></blockquote>]]></content>
<summary type="html">
<h2 id="前提"><a href="#前提" class="headerlink" title="前提"></a>前提</h2><blockquote>
<p>nodejs</p>
</blockquote>
<blockquote>
<p>npm or yarn</p>
</summary>
<category term="前端" scheme="http://yoursite.com/categories/%E5%89%8D%E7%AB%AF/"/>
<category term="前端" scheme="http://yoursite.com/tags/%E5%89%8D%E7%AB%AF/"/>
</entry>
<entry>
<title>crypto</title>
<link href="http://yoursite.com/2018/04/21/crypto/"/>
<id>http://yoursite.com/2018/04/21/crypto/</id>
<published>2018-04-21T08:16:42.000Z</published>
<updated>2018-04-21T08:27:21.077Z</updated>
<content type="html"><![CDATA[<h2 id="加密"><a href="#加密" class="headerlink" title="加密"></a>加密</h2><ul><li><p>什么是加密</p></li><li><p>什么是编码</p></li></ul><h2 id="摘要"><a href="#摘要" class="headerlink" title="摘要"></a>摘要</h2><ul><li>摘要是干什么的,跟加密有什么区别</li></ul>]]></content>
<summary type="html">
<h2 id="加密"><a href="#加密" class="headerlink" title="加密"></a>加密</h2><ul>
<li><p>什么是加密</p>
</li>
<li><p>什么是编码</p>
</li>
</ul>
<h2 id="摘要"><a h
</summary>
<category term="java" scheme="http://yoursite.com/categories/java/"/>
<category term="java" scheme="http://yoursite.com/tags/java/"/>
</entry>
<entry>
<title>关于编码</title>
<link href="http://yoursite.com/2018/04/21/Java%E7%BC%96%E7%A0%81/"/>
<id>http://yoursite.com/2018/04/21/Java编码/</id>
<published>2018-04-21T08:16:20.000Z</published>
<updated>2018-04-22T04:13:01.591Z</updated>
<content type="html"><![CDATA[<h2 id="基本概念"><a href="#基本概念" class="headerlink" title="基本概念"></a>基本概念</h2><blockquote><p>hex也称为base16,意思是使用16个可见字符来表示一个二进制数组,编码后数据大小将翻倍,因为1个字符需要用2个可见字符来表示。</p></blockquote><blockquote><p>base32,意思是使用32个可见字符来表示一个二进制数组,编码后数据大小变成原来的8/5,也即5个字符用8个可见字符表示,但是最后如果不足8个字符,将用=来补充。</p></blockquote><blockquote><p>base64,意思是使用64个可见字符来表示一个二进制数组,编码后数据大小变成原来的4/3,也即3个字符用4个可见字符来表示。</p></blockquote><h2 id="使用场景"><a href="#使用场景" class="headerlink" title="使用场景"></a>使用场景</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">有很多字符是不可见的,我们需要把这些不可见字符变成可见字符。那为啥要变成可见字符?你是看着乱码舒服还是看着可见字符舒服呢?其实不仅仅舒不舒服的问题,有些时候还必须要用可见字符,例如在网络中传输数据时,不同路由器对于不可见字符的处理是不同的,因此可能出现数据错误,因此还必须使用可见字符。</span><br></pre></td></tr></table></figure><h2 id="Unicode"><a href="#Unicode" class="headerlink" title="Unicode"></a>Unicode</h2><blockquote><p>只是一个符号集,将世界上所有的符号都纳入其中。</p></blockquote><blockquote><p>只规定了符号的二进制代码,却没有规定这个二进制代码应该如何存储。</p></blockquote><h2 id="乱码"><a href="#乱码" class="headerlink" title="乱码"></a>乱码</h2><p>乱码是因为编码、解码方式不一致,因此要知道字符的编码方式,然后按照同样的方式去解码。</p><p>编码转换方法</p><pre><code>new String("hello".getBytes("ISO-8859-1"), "UTF-8");</code></pre><h2 id="Demo"><a href="#Demo" class="headerlink" title="Demo"></a>Demo</h2><h3 id="HEX"><a href="#HEX" class="headerlink" title="HEX"></a>HEX</h3><blockquote><p>依赖Guava</p></blockquote><pre><code>/** * Hex编码, 将byte[]编码为String,默认为ABCDEF为大写字母. */public static String encodeHex(byte[] input) { return BaseEncoding.base16().encode(input);}/** * Hex解码, 将String解码为byte[]. * * 字符串有异常时抛出IllegalArgumentException. */public static byte[] decodeHex(CharSequence input) { return BaseEncoding.base16().decode(input);}</code></pre><h3 id="Base32"><a href="#Base32" class="headerlink" title="Base32"></a>Base32</h3><h3 id="Base64"><a href="#Base64" class="headerlink" title="Base64"></a>Base64</h3><blockquote><p>依赖Guava</p></blockquote><pre><code>/** * Base64编码. */public static String encodeBase64(byte[] input) { return BaseEncoding.base64().encode(input);}/** * Base64解码. * * 如果字符不合法,抛出IllegalArgumentException */public static byte[] decodeBase64(CharSequence input) { return BaseEncoding.base64().decode(input);}</code></pre><h2 id="区别与联系"><a href="#区别与联系" class="headerlink" title="区别与联系"></a>区别与联系</h2><p>区别主要就是空间效率的区别,base64是具有比较高的空间效率的。当然,hex编码不区分大小写,但是base32与base64是区分的。<br>联系就是大家都是一种稳定的把二进制数组变成可见字符的编码方式。<br>base32中StdEncoding和HexEncoding所使用的字符不同,但是具体其他区别我也不是很清楚。<br>base64中URLEncoding一般用于编码URL</p>]]></content>
<summary type="html">
<h2 id="基本概念"><a href="#基本概念" class="headerlink" title="基本概念"></a>基本概念</h2><blockquote>
<p>hex也称为base16,意思是使用16个可见字符来表示一个二进制数组,编码后数据大小将翻倍,因为
</summary>
<category term="java" scheme="http://yoursite.com/categories/java/"/>
<category term="java" scheme="http://yoursite.com/tags/java/"/>
</entry>
<entry>
<title>exception处理</title>
<link href="http://yoursite.com/2018/04/19/exception/"/>
<id>http://yoursite.com/2018/04/19/exception/</id>
<published>2018-04-18T22:51:12.000Z</published>
<updated>2018-04-18T23:15:37.862Z</updated>
<content type="html"><![CDATA[<h2 id="运行时-vs-not"><a href="#运行时-vs-not" class="headerlink" title="运行时 vs not"></a>运行时 vs not</h2><h2 id="spring统一异常处理"><a href="#spring统一异常处理" class="headerlink" title="spring统一异常处理"></a>spring统一异常处理</h2><h2 id="异常日志记录"><a href="#异常日志记录" class="headerlink" title="异常日志记录"></a>异常日志记录</h2><h2 id="异常堆栈信息"><a href="#异常堆栈信息" class="headerlink" title="异常堆栈信息"></a>异常堆栈信息</h2>]]></content>
<summary type="html">
<h2 id="运行时-vs-not"><a href="#运行时-vs-not" class="headerlink" title="运行时 vs not"></a>运行时 vs not</h2><h2 id="spring统一异常处理"><a href="#spring统
</summary>
<category term="java" scheme="http://yoursite.com/categories/java/"/>
<category term="spring" scheme="http://yoursite.com/tags/spring/"/>
<category term="aop" scheme="http://yoursite.com/tags/aop/"/>
<category term="util" scheme="http://yoursite.com/tags/util/"/>
<category term="异常" scheme="http://yoursite.com/tags/%E5%BC%82%E5%B8%B8/"/>
</entry>
<entry>
<title>logback</title>
<link href="http://yoursite.com/2018/04/19/logback/"/>
<id>http://yoursite.com/2018/04/19/logback/</id>
<published>2018-04-18T22:50:52.000Z</published>
<updated>2018-04-18T23:05:21.245Z</updated>
<summary type="html">
</summary>
<category term="java" scheme="http://yoursite.com/categories/java/"/>
<category term="util" scheme="http://yoursite.com/tags/util/"/>
<category term="springboot" scheme="http://yoursite.com/tags/springboot/"/>
<category term="日志" scheme="http://yoursite.com/tags/%E6%97%A5%E5%BF%97/"/>
</entry>
<entry>
<title>spring-mock</title>
<link href="http://yoursite.com/2018/04/19/spring-mock/"/>
<id>http://yoursite.com/2018/04/19/spring-mock/</id>
<published>2018-04-18T22:49:34.000Z</published>
<updated>2018-04-18T23:10:05.242Z</updated>
<summary type="html">
</summary>
<category term="测试" scheme="http://yoursite.com/categories/%E6%B5%8B%E8%AF%95/"/>
<category term="spring" scheme="http://yoursite.com/tags/spring/"/>
<category term="测试" scheme="http://yoursite.com/tags/%E6%B5%8B%E8%AF%95/"/>
</entry>
<entry>
<title>springboot-mybatis</title>
<link href="http://yoursite.com/2018/04/18/springboot-mybatis/"/>
<id>http://yoursite.com/2018/04/18/springboot-mybatis/</id>
<published>2018-04-18T13:48:40.000Z</published>
<updated>2018-04-18T23:05:04.795Z</updated>
<content type="html"><![CDATA[<h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>springboot集成mybaits时,有mybatis官方提供的mybatis-spring-boot-starter,但mapper不可通用,开发工作量大,<br>因此使用mapper-spring-boot-starter的通用mapper。</p><p>通用Mapper都可以极大的方便开发人员。<br>可以随意的按照自己的需要选择通用方法,还可以很方便的开发自己的通用方法。<br>极其方便的使用MyBatis单表的增删改查。<br>支持单表操作,不支持通用的多表联合查询。</p><p><a href="https://github.com/abel533/Mapper" target="_blank" rel="noopener">github</a><br><a href="https://github.com/abel533/Mapper/wiki" target="_blank" rel="noopener">wiki</a></p><h2 id="pom"><a href="#pom" class="headerlink" title="pom"></a>pom</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><dependency></span><br><span class="line"> <groupId>mysql</groupId></span><br><span class="line"> <artifactId>mysql-connector-java</artifactId></span><br><span class="line"> <scope>runtime</scope></span><br><span class="line"></dependency></span><br><span class="line"></span><br><span class="line"><dependency></span><br><span class="line"> <groupId>com.alibaba</groupId></span><br><span class="line"> <artifactId>druid-spring-boot-starter</artifactId></span><br><span class="line"> <version>${druid-starter.version}</version></span><br><span class="line"></dependency></span><br><span class="line"></span><br><span class="line"><!--mapper--></span><br><span class="line"><dependency></span><br><span class="line"> <groupId>tk.mybatis</groupId></span><br><span class="line"> <artifactId>mapper-spring-boot-starter</artifactId></span><br><span class="line"> <version>${mapper-starter.version}</version></span><br><span class="line"></dependency></span><br></pre></td></tr></table></figure><h2 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h2><ol><li>数据源配置<blockquote><p>参考druid-spring-boot-starter配置即可</p></blockquote></li><li>mybatis配置</li></ol><blockquote><p>config-location与configuration只可配置一项</p></blockquote><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">config-location: classpath:mybatis-config.xml</span><br><span class="line">configuration:</span><br><span class="line"> map-underscore-to-camel-case: true</span><br><span class="line"> log-impl: org.apache.ibatis.logging.stdout.StdOutImpl</span><br><span class="line">type-aliases-package:</span><br><span class="line">mapper-locations:</span><br></pre></td></tr></table></figure><ol start="3"><li>mapper配置</li></ol><blockquote><p>详见wiki</p></blockquote><blockquote><p>mappers配置项注意</p></blockquote><p>如果只使用通用mapper,可以不配置mappers,如果使用了MysqlMapper等其他mapper,而且自己定义了BaseMapper,要设置mappers。(一般BaseMapper继承Mapper和其他mapper,比如MysqlMapper)</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mapper:</span><br><span class="line"> mappers:</span><br><span class="line"> - com.daijk.demo.dao.base.BaseMapper</span><br></pre></td></tr></table></figure><h2 id="开撸"><a href="#开撸" class="headerlink" title="开撸"></a>开撸</h2><h3 id="关于-MapperScan"><a href="#关于-MapperScan" class="headerlink" title="关于@MapperScan"></a>关于@MapperScan</h3><p>包名必填,并且mappers配置的类不能在包下</p><h3 id="对象关系映射"><a href="#对象关系映射" class="headerlink" title="对象关系映射"></a>对象关系映射</h3><ul><li>主键 @Id</li><li>列 @Column @ColumnType</li></ul>]]></content>
<summary type="html">
<h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>springboot集成mybaits时,有mybatis官方提供的mybatis-spring-boot-starter,但mapper不
</summary>
<category term="spring" scheme="http://yoursite.com/categories/spring/"/>
<category term="springboot" scheme="http://yoursite.com/tags/springboot/"/>
<category term="mybatis" scheme="http://yoursite.com/tags/mybatis/"/>
<category term="持久化" scheme="http://yoursite.com/tags/%E6%8C%81%E4%B9%85%E5%8C%96/"/>
<category term="数据源" scheme="http://yoursite.com/tags/%E6%95%B0%E6%8D%AE%E6%BA%90/"/>
</entry>
<entry>
<title>springboot web</title>
<link href="http://yoursite.com/2018/04/16/springboot-web/"/>
<id>http://yoursite.com/2018/04/16/springboot-web/</id>
<published>2018-04-16T12:55:22.000Z</published>
<updated>2018-04-18T22:57:10.736Z</updated>
<content type="html"><![CDATA[<h2 id="依赖"><a href="#依赖" class="headerlink" title="依赖"></a>依赖</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><dependency></span><br><span class="line"> <groupId>org.springframework.boot</groupId></span><br><span class="line"> <artifactId>spring-boot-starter-web</artifactId></span><br><span class="line"></dependency></span><br><span class="line"></span><br><span class="line"><dependency></span><br><span class="line"> <groupId>org.springframework.boot</groupId></span><br><span class="line"> <artifactId>spring-boot-starter-thymeleaf</artifactId></span><br><span class="line"></dependency></span><br></pre></td></tr></table></figure><h2 id="config"><a href="#config" class="headerlink" title="config"></a>config</h2><p>参考[<a href="https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/reference/htmlsingle/#common-application-properties]" target="_blank" rel="noopener">https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/reference/htmlsingle/#common-application-properties]</a><br>WEB PROPERTIES 部分</p><h2 id="thymeleaf"><a href="#thymeleaf" class="headerlink" title="thymeleaf"></a>thymeleaf</h2><p>参考[<a href="https://www.thymeleaf.org/documentation.html]" target="_blank" rel="noopener">https://www.thymeleaf.org/documentation.html]</a></p><h2 id="ModelAndView"><a href="#ModelAndView" class="headerlink" title="ModelAndView"></a>ModelAndView</h2><h2 id="json"><a href="#json" class="headerlink" title="json"></a>json</h2><ul><li>@RestController</li></ul><h2 id="相关注解"><a href="#相关注解" class="headerlink" title="相关注解"></a>相关注解</h2><ul><li>@Controller</li><li>@RestController</li><li>@GetMapping</li><li>@PostMapping</li><li>@PutMapping</li><li>@DeleteMapping</li></ul>]]></content>
<summary type="html">
<h2 id="依赖"><a href="#依赖" class="headerlink" title="依赖"></a>依赖</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span
</summary>
<category term="spring" scheme="http://yoursite.com/categories/spring/"/>
<category term="springboot" scheme="http://yoursite.com/tags/springboot/"/>
<category term="web" scheme="http://yoursite.com/tags/web/"/>
</entry>
<entry>
<title>springboot config</title>
<link href="http://yoursite.com/2018/04/16/springboot-config/"/>
<id>http://yoursite.com/2018/04/16/springboot-config/</id>
<published>2018-04-16T12:55:22.000Z</published>
<updated>2018-04-18T22:57:33.088Z</updated>
<content type="html"><![CDATA[<h2 id="说明"><a href="#说明" class="headerlink" title="说明"></a>说明</h2><p>spingboot 可以添加自定义的配置,需要在application.yml文件中添加,并设置对应的Config类解析。<br>当然也可以指定配置文件,及相关的解析前缀。</p><h2 id="demo"><a href="#demo" class="headerlink" title="demo"></a>demo</h2><p>application.yml</p><p>server:<br> servlet:<br> context-path: /patient<br> port: 8080<br>spring:<br> thymeleaf:<br> encoding: UTF-8<br> mode: HTML</p><p>Config.java</p>]]></content>
<summary type="html">
<h2 id="说明"><a href="#说明" class="headerlink" title="说明"></a>说明</h2><p>spingboot 可以添加自定义的配置,需要在application.yml文件中添加,并设置对应的Config类解析。<br>当然也可以
</summary>
<category term="spring" scheme="http://yoursite.com/categories/spring/"/>
<category term="util" scheme="http://yoursite.com/tags/util/"/>
<category term="springboot" scheme="http://yoursite.com/tags/springboot/"/>
<category term="yml" scheme="http://yoursite.com/tags/yml/"/>
</entry>
<entry>
<title>分布式锁</title>
<link href="http://yoursite.com/2018/04/10/%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/"/>
<id>http://yoursite.com/2018/04/10/分布式锁/</id>
<published>2018-04-10T02:30:07.000Z</published>
<updated>2018-04-18T23:03:39.704Z</updated>
<content type="html"><![CDATA[<p>分布式锁的几种实现方式:<br>在分布式架构中,由于多线程和多台服务器,何难保证顺序性。如果需要对某一个资源进行限制,比如票务,比如请求幂等性控制等,这个时候分布式锁就排上用处。<br>什么是分布式锁<br>分布式锁是控制分布式系统或不同系统之间共同访问共享资源的一种锁实现,如果不同的系统或同一个系统的不同主机之间共享了某个资源时,往往需要互斥来防止彼此干扰来保证一致性。<br>分布式锁需要解决的问题<br>互斥性:任意时刻,只能有一个客户端获取锁,不能同时有两个客户端获取到锁。<br>安全性:锁只能被持有该锁的客户端删除,不能由其它客户端删除。<br>死锁:获取锁的客户端因为某些原因(如down机等)而未能释放锁,其它客户端再也无法获取到该锁。<br>容错:当部分节点(redis节点等)down机时,客户端仍然能够获取锁和释放锁。<br>分布式锁的实现方式<br>数据库实现<br>缓存实现,比如redis<br>zookeeper实现<br>未完待续</p>]]></content>
<summary type="html">
<p>分布式锁的几种实现方式:<br>在分布式架构中,由于多线程和多台服务器,何难保证顺序性。如果需要对某一个资源进行限制,比如票务,比如请求幂等性控制等,这个时候分布式锁就排上用处。<br>什么是分布式锁<br>分布式锁是控制分布式系统或不同系统之间共同访问共享资源的一种锁实现
</summary>
<category term="java" scheme="http://yoursite.com/categories/java/"/>
<category term="分布式" scheme="http://yoursite.com/tags/%E5%88%86%E5%B8%83%E5%BC%8F/"/>
</entry>
<entry>
<title>MySQL数据库规范及解读</title>
<link href="http://yoursite.com/2018/04/07/MySQL%E6%95%B0%E6%8D%AE%E5%BA%93%E8%A7%84%E8%8C%83%E5%8F%8A%E8%A7%A3%E8%AF%BB/"/>
<id>http://yoursite.com/2018/04/07/MySQL数据库规范及解读/</id>
<published>2018-04-06T23:35:18.000Z</published>
<updated>2018-04-22T04:43:53.183Z</updated>
<content type="html"><![CDATA[<p><strong>转</strong> <a href="https://my.oschina.net/u/1475115/blog/1622401" target="_blank" rel="noopener">MySQL数据库规范及解读</a></p>]]></content>
<summary type="html">
<p><strong>转</strong> <a href="https://my.oschina.net/u/1475115/blog/1622401" target="_blank" rel="noopener">MySQL数据库规范及解读</a></p>
</summary>
<category term="数据库" scheme="http://yoursite.com/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/"/>
<category term="MySQL" scheme="http://yoursite.com/tags/MySQL/"/>
</entry>
<entry>
<title>Hexo</title>
<link href="http://yoursite.com/2018/04/06/hexo/"/>
<id>http://yoursite.com/2018/04/06/hexo/</id>
<published>2018-04-06T06:23:45.000Z</published>
<updated>2018-04-18T23:02:14.757Z</updated>
<content type="html"><![CDATA[<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><h3 id="依赖"><a href="#依赖" class="headerlink" title="依赖"></a>依赖</h3><blockquote><p>node<br>yarn<br>yarn global add hexo</p></blockquote><h3 id="start"><a href="#start" class="headerlink" title="start"></a>start</h3><blockquote><p>mkdir blog && cd blog<br>yarn init</p></blockquote><h2 id="github-pages"><a href="#github-pages" class="headerlink" title="github pages"></a>github pages</h2><h3 id="add-repo"><a href="#add-repo" class="headerlink" title="add repo"></a>add repo</h3><blockquote><p>仓库名必须是github用户名,比如username.github.io</p></blockquote><h3 id="config-repo"><a href="#config-repo" class="headerlink" title="config repo"></a>config repo</h3><blockquote><p>settings -> GitHub Pages -> 选择master分支 -> save</p></blockquote><h3 id="deploy"><a href="#deploy" class="headerlink" title="deploy"></a>deploy</h3><blockquote><p>安装插件</p></blockquote><p>yarn add hexo-deployer-git</p><blockquote><p>修改配置文件</p></blockquote><p>deploy:<br> type: git<br> repo: <a href="mailto:git@github.com" target="_blank" rel="noopener">git@github.com</a>:username/username.github.io.git<br> branch: master</p><h2 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h2><h3 id="主题"><a href="#主题" class="headerlink" title="主题"></a>主题</h3><blockquote><p>下载后,修改根配置下的主题名称;<br>主题配置中修改相关项。</p></blockquote><h3 id="写作"><a href="#写作" class="headerlink" title="写作"></a>写作</h3><blockquote><p>添加page<br>添加文章(分类、标签)</p></blockquote><h3 id="配置后的动作"><a href="#配置后的动作" class="headerlink" title="配置后的动作"></a>配置后的动作</h3><ul><li><p>hexo clean</p></li><li><p>hexo generate</p></li><li><p>hexo deploy</p></li></ul><h2 id="访问"><a href="#访问" class="headerlink" title="访问"></a>访问</h2><p><a href="https://yourgithubname.github.io" target="_blank" rel="noopener">https://yourgithubname.github.io</a></p>]]></content>
<summary type="html">
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><h3 id="依赖"><a href="#依赖" class="headerlink" title="依赖"></a>依赖</h3><block
</summary>
<category term="学习" scheme="http://yoursite.com/categories/%E5%AD%A6%E4%B9%A0/"/>
<category term="other" scheme="http://yoursite.com/tags/other/"/>
<category term="hexo" scheme="http://yoursite.com/tags/hexo/"/>
</entry>
</feed>