1
- /*
2
- * Copyright (c) 2017-2018. 放牛极客<l_iupeiyu@qq.com>
3
- * <p>
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS,
10
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- * See the License for the specific language governing permissions and
12
- * limitations under the License.
13
- * </p>
14
- *
15
- */
16
-
17
1
package com .geekcattle .core .j2cache .autoconfigure ;
18
2
19
3
import org .springframework .boot .context .properties .ConfigurationProperties ;
20
-
4
+ /**
5
+ * 相关的配置信息
6
+ * @author 小雨哥哥
7
+ *
8
+ */
21
9
@ ConfigurationProperties (prefix = "j2cache" )
22
10
public class J2CacheExtendConfig {
23
-
24
11
private String configLocation = "/j2cache.properties" ;
25
12
26
13
/**
27
- * 是否开启spring cache缓存,注意:开启后需要添加spring.cache.type=none,将缓存类型设置为none
14
+ * 是否开启spring cache缓存,注意:开启后需要添加spring.cache.type=GENERIC,将缓存类型设置为GENERIC
28
15
*/
29
16
private Boolean openSpringCache = false ;
30
17
18
+ /**
19
+ * 缓存清除模式,
20
+ * <ul>
21
+ * <li>active:主动清除,二级缓存过期主动通知各节点清除,优点在于所有节点可以同时收到缓存清除</li>
22
+ * <li>passive:被动清除,一级缓存过期进行通知各节点清除一二级缓存,</li>
23
+ * <li> blend:两种模式一起运作,对于各个节点缓存准确以及及时性要求高的可以使用,正常用前两种模式中一个就可</li>
24
+ * </ul>
25
+ */
26
+ private String cacheCleanMode = "passive" ;
27
+
28
+ /**
29
+ * 是否允许缓存空值,默认:true
30
+ */
31
+ private boolean allowNullValues = true ;
32
+
33
+ /**
34
+ * 使用哪种redis客户端,默认:jedis
35
+ * <ul>
36
+ * <li><a href ='https://github.com/xetorthio/jedis'>jedis: https://github.com/xetorthio/jedis</a></li>
37
+ * <li><a href ='https://github.com/lettuce-io/lettuce-core'>lettuce: https://github.com/lettuce-io/lettuce-core</a></li>
38
+ * </ul>
39
+ */
40
+ private String redisClient = "jedis" ;
41
+
42
+
31
43
public String getConfigLocation () {
32
44
return configLocation ;
33
45
}
@@ -43,4 +55,28 @@ public Boolean getOpenSpringCache() {
43
55
public void setOpenSpringCache (Boolean openSpringCache ) {
44
56
this .openSpringCache = openSpringCache ;
45
57
}
58
+
59
+ public String getCacheCleanMode () {
60
+ return cacheCleanMode ;
61
+ }
62
+
63
+ public void setCacheCleanMode (String cacheCleanMode ) {
64
+ this .cacheCleanMode = cacheCleanMode ;
65
+ }
66
+
67
+ public boolean isAllowNullValues () {
68
+ return allowNullValues ;
69
+ }
70
+
71
+ public void setAllowNullValues (boolean allowNullValues ) {
72
+ this .allowNullValues = allowNullValues ;
73
+ }
74
+
75
+ public String getRedisClient () {
76
+ return redisClient ;
77
+ }
78
+
79
+ public void setRedisClient (String redisClient ) {
80
+ this .redisClient = redisClient ;
81
+ }
46
82
}
0 commit comments