DATAREDIS-1041 - Introduce RedisCache configuration option prefixCacheNameWith.
prefixCacheNameWith allows to prefix the cache name. The default CacheKeyPrefix.simple() format is still in place. Original pull request: #507.
This commit is contained in:
committed by
Mark Paluch
parent
f823062ef0
commit
94699ce79c
@@ -287,6 +287,22 @@ public class RedisCacheTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-1041
|
||||
public void prefixCacheNameCreatesCacheKeyCorrectly() {
|
||||
|
||||
RedisCache cacheWithCustomPrefix = new RedisCache("cache", new DefaultRedisCacheWriter(connectionFactory),
|
||||
RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(SerializationPair.fromSerializer(serializer))
|
||||
.prefixCacheNameWith("redis::"));
|
||||
|
||||
cacheWithCustomPrefix.put("key-1", sample);
|
||||
|
||||
doWithConnection(connection -> {
|
||||
|
||||
assertThat(connection.stringCommands().get("redis::cache::key-1".getBytes(StandardCharsets.UTF_8)))
|
||||
.isEqualTo(binarySample);
|
||||
});
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-715
|
||||
public void fetchKeyWithComputedPrefixReturnsExpectedResult() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user