spring-boot-2.0.3之redis緩存實(shí)現(xiàn),不是你想的那樣哦迈螟!

前言

開(kāi)心一刻

小白問(wèn)小明:“你前面有一個(gè)5米深的坑叉抡,里面沒(méi)有水钠右,如果你跳進(jìn)去后該怎樣出來(lái)了卵牍?”小明:“躺著出來(lái)唄,還能怎么出來(lái)靴寂?”小白:“為什么躺著出來(lái)烙常?”小明:“5米深的坑轴捎,還沒(méi)有水,跳下去不死就很幸運(yùn)了蚕脏,殘是肯定會(huì)殘的侦副,不躺著出來(lái),那能怎么出來(lái)驼鞭?”小白:“假設(shè)沒(méi)死也沒(méi)殘呢秦驯?”小明:“你當(dāng)我超人了? 那也簡(jiǎn)單挣棕,把腦子里的水放出來(lái)就可以漂出來(lái)了译隘。”小白:“你腦子里有這么多水嗎洛心?”小明:“我腦子里沒(méi)那么多水我跳下去干嘛固耘?”

路漫漫其修遠(yuǎn)兮,吾將上下而求索词身!

github:https://github.com/youzhibing

碼云(gitee):https://gitee.com/youzhibing

springboot 1.x到2.x變動(dòng)的內(nèi)容還是挺多的厅目,而2.x之間也存在細(xì)微的差別,本文不講這些差別(具體差別我也不知道法严,汗......)损敷,只講1.5.9與2.0.3的redis緩存配置的區(qū)別

回到頂部

springboot1.5.9緩存配置

工程實(shí)現(xiàn)

1.x系列配置應(yīng)該都差不多,下面我們看看1.5.9中深啤,springboot集成redis的緩存實(shí)現(xiàn)

pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>com.lee</groupId>

<artifactId>spring-boot159.cache</artifactId>

<version>1.0-SNAPSHOT</version>

<properties>

<java.version>1.8</java.version>

</properties>

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>1.5.9.RELEASE</version>

</parent>

<dependencies>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-web</artifactId>

</dependency>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-data-redis</artifactId>

</dependency>

</dependencies>

</project>

application.yml

server:

port: 8888

spring:

#redis配置

redis:

database: 0

host: 127.0.0.1

port: 6379

password:

# 連接超時(shí)時(shí)間(毫秒)

timeout: 2000

pool:

# 連接池最大連接數(shù)(使用負(fù)值表示沒(méi)有限制)

max-active: 8

# 連接池最大阻塞等待時(shí)間(使用負(fù)值表示沒(méi)有限制)

max-wait: -1

# 連接池中的最大空閑連接

max-idle: 8

# 連接池中的最小空閑連接

min-idle: 0

cache:

type: redis

cache:

expire-time: 180

RedisCacheConfig.java

package com.lee.cache.config;

import com.fasterxml.jackson.annotation.JsonAutoDetect;

import com.fasterxml.jackson.annotation.PropertyAccessor;

import com.fasterxml.jackson.databind.ObjectMapper;

import org.springframework.beans.factory.annotation.Value;

import org.springframework.cache.CacheManager;

import org.springframework.cache.annotation.CachingConfigurerSupport;

import org.springframework.cache.annotation.EnableCaching;

import org.springframework.cache.interceptor.KeyGenerator;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import org.springframework.data.redis.cache.RedisCacheManager;

import org.springframework.data.redis.connection.RedisConnectionFactory;

import org.springframework.data.redis.core.RedisTemplate;

import org.springframework.data.redis.core.StringRedisTemplate;

import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;

/**

* 必須繼承CachingConfigurerSupport拗馒,不然此類中生成的Bean不會(huì)生效(沒(méi)有替換掉默認(rèn)生成的,只是一個(gè)普通的bean)

* springboot默認(rèn)生成的緩存管理器和redisTemplate支持的類型很有限墓塌,根本不滿足我們的需求瘟忱,會(huì)拋出如下異常:

* org.springframework.cache.interceptor.SimpleKey cannot be cast to java.lang.String

*/

@Configuration

@EnableCaching

public class RedisCacheConfig extends CachingConfigurerSupport {

@Value("${cache.expire-time:180}")

private int expireTime;

// 配置key生成器奥额,作用于緩存管理器管理的所有緩存

// 如果緩存注解(@Cacheable、@CacheEvict等)中指定key屬性访诱,那么會(huì)覆蓋此key生成器

@Bean

public KeyGenerator keyGenerator() {

return (target, method, params) -> {

StringBuilder sb = new StringBuilder();

sb.append(target.getClass().getName());

sb.append(method.getName());

for (Object obj : params) {

sb.append(obj.toString());

}

return sb.toString();

};

}

// 緩存管理器管理的緩存都需要有對(duì)應(yīng)的緩存空間垫挨,否則拋異常:No cache could be resolved for 'Builder...

@Bean

public CacheManager cacheManager(RedisTemplate redisTemplate) {

RedisCacheManager rcm = new RedisCacheManager(redisTemplate);

rcm.setDefaultExpiration(expireTime); //設(shè)置緩存管理器管理的緩存的過(guò)期時(shí)間, 單位:秒

return rcm;

}

@Bean

public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory factory) {

StringRedisTemplate template = new StringRedisTemplate(factory);

Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);

ObjectMapper om = new ObjectMapper();

om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);

om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);

jackson2JsonRedisSerializer.setObjectMapper(om);

template.setValueSerializer(jackson2JsonRedisSerializer);

template.afterPropertiesSet();

return template;

}

}

CacheServiceImpl.java

package com.lee.cache.service.impl;

import com.lee.cache.model.User;

import com.lee.cache.service.ICacheService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.cache.annotation.Cacheable;

import org.springframework.data.redis.core.RedisTemplate;

import org.springframework.stereotype.Service;

import org.springframework.util.StringUtils;

import java.util.ArrayList;

import java.util.List;

/**

* 若未配置@CacheConfig(cacheNames = "hello"), 則@Cacheable一定要配置value,相當(dāng)于指定緩存空間

* 否則會(huì)拋異常:No cache could be resolved for 'Builder...

*

* 若@CacheConfig(cacheNames = "hello") 與 @Cacheable(value = "123")都配置了触菜, 則@Cacheable(value = "123")生效

*

* 當(dāng)然@CacheConfig還有一些其他的配置項(xiàng)九榔,Cacheable也有一些其他的配置項(xiàng)

*/

@Service

public class CacheServiceImpl implements ICacheService {

@Autowired

private RedisTemplate<String, String> redisTemplate;

@Override

@Cacheable(value = "test") // key用的自定義的KeyGenerator

public String getName() {

System.out.println("getName, no cache now...");

return "brucelee";

}

@Override

@Cacheable(value = "user", key = "methodName + '_' + #p0", unless = "#result.size() <= 0") // key會(huì)覆蓋掉KeyGenerator

public List<User> listUser(int pageNum, int pageSize) {

System.out.println("listUser no cache now...");

List<User> users = new ArrayList<>();

users.add(new User("zhengsan", 22));

users.add(new User("lisi", 20));

System.out.println("===========");

return users;

}

/**

* 緩存不是緩存管理器管理,那么不受緩存管理器的約束

* 緩存管理器中的配置不適用與此

* 這里相當(dāng)于我們平時(shí)直接通過(guò)redis-cli操作redis

* @return

*/

@Override

public String getUserName() {

String userName = redisTemplate.opsForValue().get("userName");

if (!StringUtils.isEmpty(userName)) {

return userName;

}

System.out.println("getUserName, no cache now...");

redisTemplate.opsForValue().set("userName", "userName");

return "userName";

}

}

上述只講了幾個(gè)主要的文件涡相,更多詳情請(qǐng)點(diǎn)springboot159-cache

redis 怎樣保存cache

大家一定要把工程仔細(xì)看一遍哲泊,不然下面出現(xiàn)的一些名稱會(huì)讓我們感覺(jué)不知從哪來(lái)的;

工程中的緩存分兩種:緩存管理器管理的緩存(也就是一些列注解實(shí)現(xiàn)的緩存)催蝗、redisTemplate操作的緩存

緩存管理器管理的緩存

會(huì)在redis中增加2條數(shù)據(jù)切威,一個(gè)是類型為 zset 的 緩存名~keys , 里面存放了該緩存所有的key, 另一個(gè)是對(duì)應(yīng)的key丙号,值為序列化后的json先朦;緩存名~keys可以理解成緩存空間,與我們平時(shí)所說(shuō)的具體的緩存是不一樣的犬缨。另外對(duì)緩存管理器的一些設(shè)置(全局過(guò)期時(shí)間等)都會(huì)反映到緩存管理器管理的所有緩存上喳魏;上圖中的http://localhost:8888/getName和http://localhost:8888/listUser?pageNum=1&pageSize=3對(duì)應(yīng)的是緩存管理器管理的緩存。

redisTemplate操作的緩存

會(huì)在redis中增加1條記錄怀薛,key - value鍵值對(duì)刺彩,與我們通過(guò)redis-cli操作緩存一樣;上圖中的http://localhost:8888/getUserName對(duì)應(yīng)的是redisTemplate操作的緩存枝恋。

回到頂部

spring2.0.3緩存配置

工程實(shí)現(xiàn)

pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>com.lee</groupId>

<artifactId>spring-boot-cache</artifactId>

<version>1.0-SNAPSHOT</version>

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>2.0.3.RELEASE</version>

</parent>

<dependencies>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-web</artifactId>

</dependency>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-data-redis</artifactId>

</dependency>

<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-pool2</artifactId>

</dependency>

<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-lang3</artifactId>

</dependency>

</dependencies>

</project>

application.yml

server:

port: 8889

spring:

#redis配置

redis:

database: 0

host: 127.0.0.1

port: 6379

password:

lettuce:

pool:

# 接池最大連接數(shù)(使用負(fù)值表示沒(méi)有限制)

max-active: 8

# 連接池最大阻塞等待時(shí)間(使用負(fù)值表示沒(méi)有限制)

max-wait: -1ms

# 連接池中的最小空閑連接

max-idle: 8

# 連接池中的最大空閑連接

min-idle: 0

# 連接超時(shí)時(shí)間

timeout: 2000ms

cache:

type: redis

cache:

test:

expire-time: 180

name: test

default:

expire-time: 200

緩存定制:RedisCacheManagerConfig.java

package com.lee.cache.config;

import org.springframework.beans.factory.annotation.Value;

import org.springframework.cache.CacheManager;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import org.springframework.data.redis.cache.RedisCacheConfiguration;

import org.springframework.data.redis.cache.RedisCacheManager;

import org.springframework.data.redis.connection.RedisConnectionFactory;

import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;

import org.springframework.data.redis.serializer.RedisSerializationContext;

import org.springframework.data.redis.serializer.StringRedisSerializer;

import java.time.Duration;

import java.util.HashMap;

import java.util.HashSet;

import java.util.Map;

import java.util.Set;

/**

* 進(jìn)行緩存管理的定制

* 可以不配置创倔,采用springboot默認(rèn)的也行

*/

@Configuration

public class RedisCacheManagerConfig {

@Value("${cache.default.expire-time:1800}")

private int defaultExpireTime;

@Value("${cache.test.expire-time:180}")

private int testExpireTime;

@Value("${cache.test.name:test}")

private String testCacheName;

//緩存管理器

@Bean

public CacheManager cacheManager(RedisConnectionFactory lettuceConnectionFactory) {

RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig();

// 設(shè)置緩存管理器管理的緩存的默認(rèn)過(guò)期時(shí)間

defaultCacheConfig = defaultCacheConfig.entryTtl(Duration.ofSeconds(defaultExpireTime))

// 設(shè)置 key為string序列化

.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()))

// 設(shè)置value為json序列化

.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer()))

// 不緩存空值

.disableCachingNullValues();

Set<String> cacheNames = new HashSet<>();

cacheNames.add(testCacheName);

// 對(duì)每個(gè)緩存空間應(yīng)用不同的配置

Map<String, RedisCacheConfiguration> configMap = new HashMap<>();

configMap.put(testCacheName, defaultCacheConfig.entryTtl(Duration.ofSeconds(testExpireTime)));

RedisCacheManager cacheManager = RedisCacheManager.builder(lettuceConnectionFactory)

.cacheDefaults(defaultCacheConfig)

.initialCacheNames(cacheNames)

.withInitialCacheConfigurations(configMap)

.build();

return cacheManager;

}

}

此類可不用配置,就用spring-boot自動(dòng)配置的緩存管理器也行焚碌,只是在緩存的可閱讀性上會(huì)差一些三幻。有興趣的朋友可以刪除此類試試。

CacheServiceImpl.java

package com.lee.cache.service.impl;

import com.lee.cache.model.User;

import com.lee.cache.service.ICacheService;

import org.apache.commons.lang3.StringUtils;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.cache.annotation.CacheConfig;

import org.springframework.cache.annotation.Cacheable;

import org.springframework.data.redis.core.RedisTemplate;

import org.springframework.stereotype.Service;

import java.util.ArrayList;

import java.util.List;

/**

* 若未配置@CacheConfig(cacheNames = "hello"), 則@Cacheable一定要配置value

* 若@CacheConfig(cacheNames = "hello") 與 @Cacheable(value = "123")都配置了呐能, 則@Cacheable(value = "123") 生效

*

* 當(dāng)然@CacheConfig還有一些其他的配置項(xiàng),Cacheable也有一些其他的配置項(xiàng)

*/

@Service

public class CacheServiceImpl implements ICacheService {

@Autowired

private RedisTemplate<String, String> redisTemplate;

@Override

@Cacheable(value = "test", key = "targetClass + '_' + methodName")

public String getName() {

System.out.println("getName, no cache now...");

return "brucelee";

}

@Override

@Cacheable(value = "user", key = "targetClass + ':' + methodName + '_' + #p0", unless = "#result.size() <= 0")

public List<User> listUser(int pageNum, int pageSize) {

System.out.println("listUser no cache now...");

List<User> users = new ArrayList<>();

users.add(new User("zhengsan", 22));

users.add(new User("lisi", 20));

return users;

}

/**

* 緩存不是緩存管理器管理抑堡,那么不受緩存管理器的約束

* 緩存管理器中的配置不適用與此

* 這里相當(dāng)于我們平時(shí)直接通過(guò)redis-cli操作redis

* @return

*/

@Override

public String getUserName() {

String userName = redisTemplate.opsForValue().get("userName");

if (StringUtils.isNotEmpty(userName)) {

return userName;

}

System.out.println("getUserName, no cache now...");

redisTemplate.opsForValue().set("userName", "userName");

return "userName";

}

}

更多詳情請(qǐng)點(diǎn)spring-boot-cache

redis 怎樣保存cache

我們來(lái)看圖說(shuō)話摆出,看看緩存在redis中是如何保存的

工程中的緩存分兩種:緩存管理器管理的緩存(也就是一些列注解實(shí)現(xiàn)的緩存)、redisTemplate操作的緩存

緩存管理器管理的緩存

會(huì)在redis中增加1條數(shù)據(jù)首妖,key是以緩存空間開(kāi)頭的字符串(緩存空間名::緩存key)偎漫,值為序列化后的json;上圖中的http://localhost:8889/getName和http://localhost:8889/listUser?pageNum=1&pageSize=3對(duì)應(yīng)的是緩存管理器管理的緩存有缆。

redisTemplate操作的緩存

會(huì)在redis中增加1條記錄象踊,key - value鍵值對(duì)温亲,與我們通過(guò)redis-cli操作緩存一樣;上圖中的http://localhost:8889/getUserName對(duì)應(yīng)的是redisTemplate操作的緩存杯矩。

回到頂部

總結(jié)

1栈虚、有時(shí)候我們引入spring-boot-starter-cache這個(gè)starter只是為了快速添加緩存依賴,目的是引入spring-context-support史隆;如果我們的應(yīng)用中中已經(jīng)有了spring-context-support魂务,那么我們無(wú)需再引入spring-boot-starter-cache,例如我們的應(yīng)用中依賴了spring-boot-starter-web泌射,而spring-boot-starter-web中又有spring-context-support依賴粘姜,所以我們無(wú)需再引入spring-boot-starter-cache。

2熔酷、Supported Cache Providers孤紧,講了支持的緩存類型以及默認(rèn)情況下的緩存加載方式,可以通讀下拒秘。

3号显、只要我們引入了redis依賴,并將redis的連接信息配置正確翼抠,springboot(2.0.3)根據(jù)我們的配置會(huì)給我們生成默認(rèn)的緩存管理器和redisTemplate咙轩;我們也可以自定義我們自己的緩存管理器來(lái)替換掉默認(rèn)的,只要我們自定義了緩存管理器和redisTemplate阴颖,那么springboot的默認(rèn)生成的會(huì)替換成我們自定義的活喊。

4、緩存管理器對(duì)緩存的操作也是通過(guò)redisTemplate實(shí)現(xiàn)的量愧,只是進(jìn)行了統(tǒng)一的管理钾菊,并且能夠減少我么的代碼量,我們可以將更多的精力放到業(yè)務(wù)處理上偎肃。

5煞烫、redis-cli -h 127.0.0.1 -p 6379 -a 123456與redis-cli -a 123456兩種方式訪問(wèn)到的數(shù)據(jù)完全不一致,好像操作不同的庫(kù)一樣累颂! 這個(gè)需要注意滞详,有空我回頭看看這兩者到底有啥區(qū)別,有知道的朋友可以留個(gè)言紊馏。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末料饥,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子朱监,更是在濱河造成了極大的恐慌岸啡,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,627評(píng)論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件赫编,死亡現(xiàn)場(chǎng)離奇詭異巡蘸,居然都是意外死亡奋隶,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,180評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門(mén)悦荒,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)唯欣,“玉大人,你說(shuō)我怎么就攤上這事逾冬∈蚰簦” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 169,346評(píng)論 0 362
  • 文/不壞的土叔 我叫張陵身腻,是天一觀的道長(zhǎng)产还。 經(jīng)常有香客問(wèn)我,道長(zhǎng)嘀趟,這世上最難降的妖魔是什么脐区? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 60,097評(píng)論 1 300
  • 正文 為了忘掉前任,我火速辦了婚禮她按,結(jié)果婚禮上牛隅,老公的妹妹穿的比我還像新娘。我一直安慰自己酌泰,他們只是感情好媒佣,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,100評(píng)論 6 398
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著陵刹,像睡著了一般默伍。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上衰琐,一...
    開(kāi)封第一講書(shū)人閱讀 52,696評(píng)論 1 312
  • 那天也糊,我揣著相機(jī)與錄音,去河邊找鬼羡宙。 笑死狸剃,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的狗热。 我是一名探鬼主播钞馁,決...
    沈念sama閱讀 41,165評(píng)論 3 422
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼匿刮!你這毒婦竟也來(lái)了指攒?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 40,108評(píng)論 0 277
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤僻焚,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后膝擂,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體虑啤,經(jīng)...
    沈念sama閱讀 46,646評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡隙弛,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,709評(píng)論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了狞山。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片全闷。...
    茶點(diǎn)故事閱讀 40,861評(píng)論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖萍启,靈堂內(nèi)的尸體忽然破棺而出总珠,到底是詐尸還是另有隱情,我是刑警寧澤勘纯,帶...
    沈念sama閱讀 36,527評(píng)論 5 351
  • 正文 年R本政府宣布局服,位于F島的核電站,受9級(jí)特大地震影響驳遵,放射性物質(zhì)發(fā)生泄漏淫奔。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,196評(píng)論 3 336
  • 文/蒙蒙 一堤结、第九天 我趴在偏房一處隱蔽的房頂上張望唆迁。 院中可真熱鬧,春花似錦竞穷、人聲如沸唐责。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,698評(píng)論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)鼠哥。三九已至,卻和暖如春月弛,著一層夾襖步出監(jiān)牢的瞬間肴盏,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,804評(píng)論 1 274
  • 我被黑心中介騙來(lái)泰國(guó)打工帽衙, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留菜皂,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 49,287評(píng)論 3 379
  • 正文 我出身青樓厉萝,卻偏偏與公主長(zhǎng)得像恍飘,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子谴垫,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,860評(píng)論 2 361

推薦閱讀更多精彩內(nèi)容

  • Spring Cloud為開(kāi)發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見(jiàn)模式的工具(例如配置管理章母,服務(wù)發(fā)現(xiàn),斷路器翩剪,智...
    卡卡羅2017閱讀 134,716評(píng)論 18 139
  • Spring Boot 參考指南 介紹 轉(zhuǎn)載自:https://www.gitbook.com/book/qbgb...
    毛宇鵬閱讀 46,867評(píng)論 6 342
  • 當(dāng)我們使用@Cacheable注解的時(shí)候會(huì)將返回的對(duì)象緩存起來(lái)乳怎,我們會(huì)發(fā)現(xiàn)默認(rèn)緩存的值是二進(jìn)制的,不方便查看前弯,為此...
    java菜閱讀 1,865評(píng)論 0 1
  • 緩存是最直接有效提升系統(tǒng)性能的手段之一蚪缀。個(gè)人認(rèn)為用好用對(duì)緩存是優(yōu)秀程序員的必備基本素質(zhì)秫逝。 本文結(jié)合實(shí)際開(kāi)發(fā)經(jīng)驗(yàn),從...
    Java小生閱讀 815評(píng)論 1 3
  • 今年上半年四月我開(kāi)始了每天碼字,經(jīng)過(guò)三個(gè)月的時(shí)間基本上把碼字這個(gè)習(xí)慣養(yǎng)成了金蜀。但是回看寫(xiě)的內(nèi)容都是些沒(méi)營(yíng)養(yǎng)的流水賬式...
    我就是卷貓閱讀 213評(píng)論 4 0