forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not increment metrics on CaffeineCache#getIfPresent call
- Loading branch information
Showing
4 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
integration-tests/cache/src/main/java/io/quarkus/it/cache/CaffeineCacheWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.quarkus.it.cache; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkus.cache.Cache; | ||
import io.quarkus.cache.CacheName; | ||
import io.quarkus.cache.CaffeineCache; | ||
|
||
@ApplicationScoped | ||
public class CaffeineCacheWrapper { | ||
|
||
public static final String GET_IF_PRESENT_CACHE_NAME = "getIfPresentCache"; | ||
|
||
@CacheName(GET_IF_PRESENT_CACHE_NAME) | ||
Cache cache; | ||
|
||
public CompletableFuture<Object> getIfPresent(Object key) { | ||
return cache.as(CaffeineCache.class).getIfPresent(key); | ||
} | ||
|
||
public void put(Object key, CompletableFuture<Object> value) { | ||
cache.as(CaffeineCache.class).put(key, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters