惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
M
MIT News - Artificial intelligence
GbyAI
GbyAI
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
爱范儿
爱范儿
N
Netflix TechBlog - Medium
U
Unit 42
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园 - 叶小钗
G
Google Developers Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
腾讯CDC

博客园 - 上校

gitea设置 在Cocos Creator 项目里安装 cocos-mcp-server nginx安装教程 nacos安装教程 minio安装教程 GIT笔记 CC教程 芋道笔记 SpringCloud MySqlSugar常用写法 linux查找大目录和大文件 .NET代码混淆——开源.net 混淆器ConfuserEx介绍 微软云SQL数据库创建只读用户 nginx配置ssl证书实现https访问 nexus搭建私服 Linux下创建用户并设置权限 ActiveMQ修改密码 shiro源码篇 - shiro的session共享,你值得拥有 Docker虚拟化管理:30分钟教你学会用Docker Shiro结合Redis实现分布式或集群环境下的Session共享 Springboot整合redis spring boot2整合shiro安全框架实现前后端分离的JWT token登录验证 http post scp命令 Linux和Windows文件互传
google guava
上校 · 2020-08-23 · via 博客园 - 上校
引入maven 
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>

//创建缓存
Cache<String, String> cache = CacheBuilder.newBuilder() .maximumSize(10000) .concurrencyLevel(10) .expireAfterWrite(30, TimeUnit.SECONDS) .build();
//设置缓存 cache.put(
"1", "xx");
//获取缓存,没有则返回null
cache.getIfPresent("2"); //获取缓存,没有就设置一个 String v = cache.get("3", () -> "33");