Skip to content

Commit

Permalink
doc: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
GangCheng committed Aug 18, 2023
1 parent aeb0d34 commit 8ebc644
Showing 1 changed file with 84 additions and 2 deletions.
86 changes: 84 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,84 @@
# reactive-cache-support
reactive-cache-support
# Reactive Cache Support

[![Java CI with Maven](https://github.com/chenggangpro/reactive-cache-support/actions/workflows/maven-ci.yml/badge.svg?branch=develop)](https://github.com/chenggangpro/reactive-cache-support/actions/workflows/maven-ci.yml)
[![Coverage](.github/badges/jacoco.svg)](https://github.com/chenggangpro/reactive-cache-support/actions/workflows/maven-ci.yml)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

#### This project is supposed to implement the general reactive cache operation approach.

#### Introduction

* This project is compatible with `reactivestream` aka [`project-reactor`](https://projectreactor.io/)
* This project could integrate with `Spring Framework` (version>= 2.x)
* This project implement reactive cache for business application scenarios. The default implementation includes the following:
* `InmemeoryReactiveCache` uses `java.util.DelayQueue` to implement cache behavior
* `RedisReactiveCache` uses `redis` and `spring-boot-redis` to implement cache behavior
* `DefaultReactiveCache` uses customized configuration to implement cache behavior

#### Usage

* Standalone usages

> InmemoryReactiveCache
```java
ReactiveCacheManager reactiveCacheManager = ReactiveCacheManagerBuilder.newInmemoryReactiveManagerBuilder()
.withMaxWaitingDuration(Duration.ofSeconds(5))
.withInmemoryReactiveCacheLock()
.build();
```

> RedisReactiveCache
```java
ReactiveCacheManager reactiveCacheManager = ReactiveCacheManagerBuilder.newRedisReactiveManagerBuilder(
reactiveRedisTemplate)
.withMaxWaitingDuration(Duration.ofSeconds(5))
.withRedisReactiveCacheLock()
.build();
```

> Customized ReactiveCache
```java
ReactiveCacheManager reactiveCacheManager = ReactiveCacheManagerBuilder.newCustomReactiveManagerBuilder()
.withMaxWaitingDuration(Duration.ofSeconds(5))
// Customized ReactiveCacheLock instance implemented interface ReactiveCacheLock
.withReactiveCacheLock()
// Customized ReactiveCacheMonoAdapter instance implemented interface ReactiveCacheMonoAdapter
.withReactiveCacheMonoAdapter()
// Customized ReactiveCacheFluxAdapter instance implemented interface ReactiveCacheFluxAdapter
.withReactiveCacheFluxAdapter()
.build();
```

* SpringBoot usages

* Configuration properties as:

```yaml
reactive:
cache:
enabled: true
type: inmemory
```

* Using with spring auto-injection

```java
@Autowired
ReactiveCacheManager reactiveCacheManager;
```

* For more details, please refer to the source code and the test cases.

#### Note:

* Test cases run with `testcontainers`, so please ensure that you have access to `Docker` in your local environment.







0 comments on commit 8ebc644

Please sign in to comment.