https://github.com/previousdeveloper/java-distributed-data-cache
Spring Boot, Quarkus Distributed Cache project implements (property-based) configuring of multiple backend providers
https://github.com/previousdeveloper/java-distributed-data-cache
cache distributed spring spring-boot
Last synced: 6 months ago
JSON representation
Spring Boot, Quarkus Distributed Cache project implements (property-based) configuring of multiple backend providers
- Host: GitHub
- URL: https://github.com/previousdeveloper/java-distributed-data-cache
- Owner: previousdeveloper
- Created: 2020-03-30T09:31:38.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-08T12:33:35.000Z (over 5 years ago)
- Last Synced: 2025-07-08T10:03:27.223Z (7 months ago)
- Topics: cache, distributed, spring, spring-boot
- Homepage:
- Size: 99.6 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Spring Boot Distributed Cache
Spring Boot Distributed Cache project implements (property-based) configuring of multiple backend providers.
It works best with [Spring Boot](https://github.com/spring-projects/spring-boot), implementing [auto-configuration](https://github.com/previousdeveloper/spring-boot-distributed-data-cache) mechanism.
## Spring Boot Starter
```xml
com.trendyol
distributed-data-cache-spring-boot-starter
0.0.1-SNAPSHOT
```
## Quarkus Starter
```xml
com.trendyol
distributed-data-cache-quarkus-core
0.0.1-SNAPSHOT
```
### Getting Started
```java
@RestController
public class WelcomeResource {
@Value("${welcome.message}")
private String welcomeMessage;
@ResponseCache
@GetMapping("/welcome")
public String retrieveWelcomeMessage() {
return welcomeMessage;
}
@Autowired
private BasicConfiguration configuration;
@ResponseCache
@RequestMapping("/dynamic-configuration")
public Map dynamicConfiguration() {
Map map = new HashMap<>();
map.put("message", configuration.getMessage());
map.put("number", configuration.getNumber());
map.put("key", configuration.isValue());
return map;
}
}
```
ResponseCache annonation automatically caches your response to backend provider.
```java
//Cache if response header hash this key
@ResponseCache(responseHeaderName="bla")
//Cache if enabled
@ResponseCache(enabled=true)
//Cache expire time
@ResponseCache(expireInMinutes=10)
```
### Configuration Properties
- Couchase Provider
```
distributed:
cache:
enabled: true
platform: couchbase
couchbase:
bootstrapHosts: "localhost"
username: "bucketusername"
password: "bucketpassword"
bucket: "buckname"
```
- Redis Provider
```
distributed:
cache:
enabled: true
platform: redis
redis:
url: "localhost"
username: "username"
password: "password"
```
- Http Backend Provider
```
distributed:
cache:
enabled: true
url: "http://localhost:8083/config/age"
```