Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rburgst/cacheable-sample
Sample project showing that @Cacheable does not work properly in micronaut 1.0.2
https://github.com/rburgst/cacheable-sample
Last synced: 2 days ago
JSON representation
Sample project showing that @Cacheable does not work properly in micronaut 1.0.2
- Host: GitHub
- URL: https://github.com/rburgst/cacheable-sample
- Owner: rburgst
- Created: 2019-01-05T19:25:03.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-05T19:29:27.000Z (almost 6 years ago)
- Last Synced: 2024-11-08T17:53:07.614Z (about 2 months ago)
- Language: Kotlin
- Size: 444 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Sample for micronaut caching issue
Sample source to demonstrate that `@Cacheable` on a method that returns a `Publisher` does not work.
### Steps to reproduce
1. run the app
```bash
./gradlew run
```
2. send an http request multiple times```bash
http :8080/hello
```
### Expectedthe method `HelloService.calculateValue(0)` should only be called once, which should produce the following
output:```
20:18:07.133 [nioEventLoopGroup-1-3] INFO c.s.$HelloServiceDefinition$Intercepted - Calculating value for 0
```### Actual
the method is called multiple times producing the output
```
20:17:53.374 [nioEventLoopGroup-1-2] INFO c.s.$HelloServiceDefinition$Intercepted - Calculating value for 0
20:18:07.133 [nioEventLoopGroup-1-3] INFO c.s.$HelloServiceDefinition$Intercepted - Calculating value for 0
20:18:17.442 [nioEventLoopGroup-1-3] DEBUG i.m.c.interceptor.CacheInterceptor - Value found in cache [num-cache] for invocation: Publisher calculateValue(int num)
20:18:20.828 [nioEventLoopGroup-1-4] INFO c.s.$HelloServiceDefinition$Intercepted - Calculating value for 0
20:18:23.043 [nioEventLoopGroup-1-4] DEBUG i.m.c.interceptor.CacheInterceptor - Value found in cache [num-cache] for invocation: Publisher calculateValue(int num)
```