Bạn có chắc chắn muốn xóa bài viết này không ?
Bạn có chắc chắn muốn xóa bình luận này không ?
SpringBoot Caffeine cache with PostgreSQL backend
https://grokonez.com/spring-framework/spring-boot/springboot-caffeine-cache-postgresql-backend
SpringBoot Caffeine cache with PostgreSQL backend
Performance is a big problem in software development. And Caching is one solution to speed up system. In the tutorial, JavaSampleApproach will show you how to use SpringBoot Caffeine cache with PostGreSQL backend.
Related posts:
- How to work with Spring Cache | Spring Boot
- Couchbase – How to create Spring Cache Couchbase application with SpringBoot
- SpringBoot Hazelcast cache with PostgreSQL backend
I. Technologies
– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring Boot: 1.5.6RELEASE
– Couchbase 4.6.2
II. SpringBoot Caffeine cache
What is Caffeine cache?
In the org.springframework.boot.autoconfigure.cache.CacheProperties
, we can see:
[..]
@ConfigurationProperties(prefix = "spring.cache")
public class CacheProperties {
[..]
/**
* Guava specific cache properties.
*/
public static class Guava {
@Deprecated
@DeprecatedConfigurationProperty(reason = "Caffeine will supersede the Guava support in Spring Boot 2.0", replacement = "spring.cache.caffeine.spec")
public String getSpec() {
return this.spec;
}
@Deprecated
public void setSpec(String spec) {
this.spec = spec;
}
[..]
-> Caffeine is a Java 8 rewrite of Guava’s cache that supersede the Guava support.
In the tutorial, we use SpringBoot and Caffeine cache with PostGreSQL backend as below architecture:
For work with SpringCache Caffeine, we need dependencies:
https://grokonez.com/spring-framework/spring-boot/springboot-caffeine-cache-postgresql-backend
SpringBoot Caffeine cache with PostgreSQL backend






