Lingpj's blog

不忘初心,方得始终


  • 首页

  • 分类

  • 归档

  • 标签

  • 搜索

Java8学习笔记之Lambda表达式

发表于 2017-04-19 | 分类于 Java | 阅读次数

Lambda.jpg
使用Lambda表达式,我们可以很简洁地传递代码(通常是匿名函数)。

结构

Lambda表达式主要分为三部分:参数列表,箭头,Lambda 主体

阅读全文 »

Java8学习笔记之行为参数化

发表于 2017-04-17 | 分类于 Java | 阅读次数

用一个例子说明行为参数化带来的变化 - 从苹果仓库中筛选苹果

版本1

从一个苹果集合中选出绿的苹果

1
2
3
4
5
6
7
8
9
public static List<Apple> filterGreenApples(List<Apple> inventory) {
List<Apple> result = new ArrayList<Apple>();
for (Apple apple : inventory) {
if ("green".equals(apple.getColor()) {
result.add(apple);
}
}
return result;
}

阅读全文 »

HTML转图片利器:wkhtmltox

发表于 2017-04-01 | 分类于 日常记录 | 阅读次数

关于wkhtmltox,是一个可以把HTML转换为图片和pdf的工具。

wkhtmltox.jpg

不多介绍了,详见官网 https://wkhtmltopdf.org/

阅读全文 »

SpringBoot中使用Redis实现缓存

发表于 2017-03-30 | 分类于 Spring | 阅读次数

Spring Data Redis为我们封装了Redis客户端的各种操作,简化使用。

  • 当Redis当做数据库或者消息队列来操作时,我们一般使用RedisTemplate来操作
  • 当Redis作为缓存使用时,我们可以将它作为Spring Cache的实现,直接通过注解使用

关于RedisTemplate的使用可参考:http://blog.didispace.com/springbootredis/

下面总结使用Redis作为缓存

引入依赖

SpringBoot从1.4版本开始,spring-boot-starter-redis依赖改名了。

1
2
3
4
5
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>1.5.2.RELEASE</version>
</dependency>

阅读全文 »

手动安装redis-3.2.8的详细步骤

发表于 2017-03-21 | 分类于 NoSQL | 阅读次数

CentOS6.7使用yum安装有时候没有比较新的版本,所以手动安装,下面记录一下步骤。

redis

下载最新版本

以3.2.8为例,附上地址:redis-3.2.8.tar.gz

阅读全文 »
1…345…10
Joepis

Joepis

46 日志
6 分类
39 标签
RSS
GitHub 码云
友情链接
  • 阮一峰
© 2016 - 2021 Joepis
由 Hexo 强力驱动
主题 - NexT.Mist