Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache programmatic API - support asynchronous value loader #30311

Closed
mkouba opened this issue Jan 11, 2023 · 3 comments · Fixed by #30314
Closed

Cache programmatic API - support asynchronous value loader #30311

mkouba opened this issue Jan 11, 2023 · 3 comments · Fixed by #30314
Labels
area/cache kind/enhancement New feature or request
Milestone

Comments

@mkouba
Copy link
Contributor

mkouba commented Jan 11, 2023

Description

The value is currently loaded synchronously, i.e. there is Cache.get(K, Function<K, V>). It might be useful to add an asynchronous variant so that the value can be loaded by async APIs (without blocking).

Implementation ideas

We could add something like Cache.get(K, Function<K, Uni<V>>).

@mkouba mkouba added the kind/enhancement New feature or request label Jan 11, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 11, 2023

/cc @gwenneg(cache)

@mkouba
Copy link
Contributor Author

mkouba commented Jan 11, 2023

Note that due to type erasure we would have to use a different method name (?) or introduce a new interface such as:

interface AsyncValueLoader<K,V> {
   Uni<V> load(K key);
}

and then the new method could be something like io.quarkus.cache.Cache.get(K, AsyncValueLoader<K, V>).

@mkouba
Copy link
Contributor Author

mkouba commented Jan 11, 2023

Actually, the new interface would not help in case of lambda arguments :-(

mkouba added a commit to mkouba/quarkus that referenced this issue Jan 11, 2023
mkouba added a commit to mkouba/quarkus that referenced this issue Jan 12, 2023
mkouba added a commit to mkouba/quarkus that referenced this issue Jan 13, 2023
mkouba added a commit to mkouba/quarkus that referenced this issue Jan 13, 2023
mkouba added a commit to mkouba/quarkus that referenced this issue Jan 18, 2023
- resolves quarkusio#30311
- CacheResultInterceptor - use Cache#getAsync() for async return types
- deprecate UnresolvedUniValue
mkouba added a commit to mkouba/quarkus that referenced this issue Jan 18, 2023
- resolves quarkusio#30311
- CacheResultInterceptor - use Cache#getAsync() for async return types
- deprecate UnresolvedUniValue
@quarkus-bot quarkus-bot bot added this to the 2.17 - main milestone Jan 19, 2023
mfpc pushed a commit to mfpc/quarkus that referenced this issue Jan 19, 2023
- resolves quarkusio#30311
- CacheResultInterceptor - use Cache#getAsync() for async return types
- deprecate UnresolvedUniValue
ebullient pushed a commit to maxandersen/quarkus that referenced this issue Jan 24, 2023
- resolves quarkusio#30311
- CacheResultInterceptor - use Cache#getAsync() for async return types
- deprecate UnresolvedUniValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cache kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant