Skip to content

Commit

Permalink
Redis Cache - Allow usage of cache name when prefix is defined
Browse files Browse the repository at this point in the history
Resolves: quarkusio#44693
  • Loading branch information
thibaultmeyer committed Dec 1, 2024
1 parent 2649fa7 commit 27e91bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public Uni<?> apply(List<String> listOfKeys) {

String computeActualKey(String key) {
if (cacheInfo.prefix != null) {
return cacheInfo.prefix + ":" + key;
return cacheInfo.prefix.replace("{cache-name}", getName()) + ":" + key;
} else {
return "cache:" + getName() + ":" + key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public class RedisCacheRuntimeConfig {
Optional<Duration> expireAfterAccess;

/**
* the key prefix allowing to identify the keys belonging to the cache.
* If not set, use "cache:$cache-name"
* The key prefix allowing to identify the keys belonging to the cache.
* If not set, the value "{@code cache:{cache-name}}" will be used. The variable
* "{@code {cache-name}}" is resolved from the value set in the cache annotations.
*/
@ConfigItem
public Optional<String> prefix;
Expand Down

0 comments on commit 27e91bc

Please sign in to comment.