0%

配置redis

1
2
3
4
5
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
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
<bean id="stringRedisSerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
<bean id="jsonRedisSerializer" class="org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer"/>

系统内进行使用,hash key使用generic,value使用jdk进行序列化

<!-- redis template definition -->

<bean id="redisTemplate"
class="org.springframework.data.redis.core.RedisTemplate" primary="true">
<property name="connectionFactory" ref="jedisConnFactory"/>
<property name="keySerializer" ref="stringRedisSerializer"/>
<property name="hashKeySerializer" ref="jsonRedisSerializer"/>
</bean>

<bean id="statisticsRedisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
<property name="connectionFactory" ref="jedisConnFactory"/>
<property name="keySerializer" ref="stringRedisSerializer"/>
<property name="valueSerializer" ref="stringRedisSerializer"/>
</bean>

<bean id="redisTemplateSecond" class="org.springframework.data.redis.core.RedisTemplate">
<property name="connectionFactory" ref="jedisConnFactory"/>
<property name="keySerializer" ref="stringRedisSerializer"/>
<property name="valueSerializer" ref="jsonRedisSerializer"/>
</bean>
阅读全文 »

在实际开发中,会使用git作为版本控制工具来完成团队协作,因此,对命令做部分常用操作的归纳总结,方便日常查看使用。

阅读全文 »

ObjectId组成

ObjectId 是一个12字节 BSON 类型数据,有以下格式:

  • 前4个字节表示时间戳
  • 接下来的3个字节是机器标识码
  • 紧接的两个字节由进程id组成(PID)
  • 最后三个字节是随机数。

MongoDB中存储的文档必须有一个”_id”键。这个键的值可以是任何类型的,默认是个ObjectId对象。

在一个集合里面,每个文档都有唯一的”_id”值,来确保集合里面每个文档都能被唯一标识。

MongoDB采用ObjectId,而不是其他比较常规的做法(比如自动增加的主键)的主要原因,因为在多个 服务器上同步自动增加主键值既费力还费时。

阅读全文 »

工具介绍

1、hexo介绍

Hexo是一个快速、简洁且高效的博客框架。Hexo使用Markdown解析文章,在几秒内,即可利用靓丽的主题生成静态网页

2、Markdown介绍

Markdown是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式。

阅读全文 »

博客页面点击弹出爱心特效,操作方式本文以yilia主题模板为例,在主题文件夹下的source文件夹下是否存在js文件夹,不存在需创建。在js文件夹内创建爱心特效的后缀为click-live.js的文件,粘贴js代码如下:

阅读全文 »

博客页面鼠标悬停即可展示该特效,操作方式本文以yilia主题模板为例,在主题文件夹下的source文件夹下是否存在js文件夹,不存在需创建。在js文件夹内创建鼠标线条特效的后缀为mouseline.js的文件,粘贴js代码如下:

阅读全文 »