We now emit false when SET XX/SET NX complete without setting the value because the condition was evaluated to not set the value. Previously, we did not emit a value as Redis responds null (nil). This behavior becomes visible through ReactiveValueOperations.set[ifPresent|ifAbsent](…) methods.
This is a breaking change in the sense that changes the character of ReactiveValueOperations.set[ifPresent|ifAbsent](…) from an optionally emitted element to always emit. Reactive sequences that currently resume operation with .switchIfEmpty(…) will no longer utilize the fallback publisher.
Original pull request: #317.
We now support aggregation and weight options for ZINTERSTORE. We also encapsulate weights used for ZUNIONSTORE and ZINTERSTORE within a Weights value object.
zSetOps.intersectAndStore(set1, Arrays.asList(set2, set3), out, Aggregate.MAX,
Weights.of(1, 2, 1));
Related ticket: DATAREDIS-515.
Original Pull Request: #314
We now expose the underlying Redis Client instance via RedisClientProvider.getRedisClient() to components that require direct client interaction. The client is exposed through ClusterConnectionProvider and now also through LettucePoolingConnectionProvider.
Exposing the client via LettucePoolingConnectionProvider allows Redis Cluster usage with connection pooling.
Original Pull Request: #316
Added test with decimal and date map keys to verify those are flattened out correctly using the converters registered and updated documentation to point out limitation of map keys to simple types.
Original Pull Request: #312
We now consider the key type when reading a map from a Redis Hash. Previously, map keys were read as string while a map could declare numeric keys.
Original Pull Request: #312
Rename prefixKeysWith(CacheKeyPrefix) to computePrefixWith(…) and drop computePrefixWith(Function) in favor of CacheKeyPrefix. Refactor nullable keyPrefix to non-nullable. Extract default prefixing scheme to CacheKeyPrefix.simple().
Original pull request: #313.
We now allow, in addition to a static key prefix, the computation of prefixes based on the cache name. This change introduces an alternative to the in 2.x removed org.springframework.data.redis.cache.RedisCacheKey, and gives users more control over cache key generation.
Original pull request: #313.
We now provide a flag to disable the in flight cache creation for unconfigured caches. This gives eg. a CompositeCacheManager the possibility to chime in.
Original pull request: #311.
We now enable pool usage when configuring JedisConnectionFactory with RedisSentinelConfiguration to prevent accidental connections using the non-pooled standalone configuration. Jedis can operate with Sentinel only with pooling.
We also reject calls to disable pooling when JedisConnectionFactory is configured to use Sentinel.
Original Pull request: #307
We now order and assemble results of multi-key commands (e.g. MGET with cross-slot keys) that are executed on different nodes by positional keys to retain duplicate keys in the requested order and retain the server response.
Previously duplicate keys were treated as set of keys and the response didn't match the requested keys.
Original Pull Request: #303
We now rely more on Jedis to select the appropriate Redis database and we no longer select the database when opening/closing a connection. Previously, we always reset the database if a database index greater zero was configured.
A properly configured Jedis pool ensures that the appropriate database is selected even if the database was selected during connection interaction.
Relying on Jedis reduces the number of issued SELECT commands and improves that way overall performance when executing commands via the Template API.
Original Pull Request: #291
We now support Redis hashes via Repository support that contain colon in their id. We're using colons to split a composite id string into keyspace and id parts. Previously, we partially rejected processing of id's that don't exactly match the number of parts delimited by colon. This caused leftovers in secondary indexes.
Original Pull Request: #298
Some minor code and documentation changes. More interestingly obtain the RedisConverter instead of the KeyValueAdapter for IndexResolver resolution in QueryByExampleRedisExecutor and stick to findOne contract by throwing IncorrectResultSizeDataAccessException for queries returning non unique results.
Original Pull Request: #301
We now support query by example via Redis repositories. We allow case-sensitive, exact matching of singular simple and nested properties, using any/all match modes, value transformation of the criteria value for indexed properties.
We do not support findAll with sorting, case-insensitive properties or string matchers other than exact.
interface PersonRepository extends QueryByExampleExecutor<Person> {
}
class PersonService {
@Autowired PersonRepository personRepository;
List<Person> findPeople(Person probe) {
return personRepository.findAll(Example.of(probe));
}
}
Original Pull Request: #301
Fix tests not closing connections properly. Remove usage of Optional in constructors, avoid recreating DirectFieldAccessor on every getConnection call and update documentation.
Original Pull Request: #287
We now allow configuration of ReadFrom settings using the Lettuce driver to enable slave reads. If ReadFrom is configured, we opt-in to Master/Slave connections instead of plain connections. Master/Slave connections route commands to the configured type of node depending on whether the command is a read or write command.
LettuceClientConfiguration configuration = LettuceClientConfiguration.builder().readFrom(ReadFrom.SLAVE).build();
ReadFrom is available for:
* Static Master/Slave Redis without Redis Sentinel
* Sentinel-Managed Master/Slave Redis
* Redis Cluster
ReadFrom is not configured for Pub/Sub connections or connections to the actual Sentinel servers.
Original Pull Request: #287
Add Template methods for unlink(…). Align unlink with del/mDel methods on reactive API using concatMap to retain order and provide batching/streaming. Reword Javadoc. Extend tests.
Replace blocking calls with StepVerifier in LettuceReactiveKeyCommandsTests.
Original pull request: #294.
We now support UNLINK for both Jedis & Lettuce throughout the single node and cluster connection. Reactive support is only available for Lettuce.
Original pull request: #294.
We now support Redis connections using OS-native transports through unix domain sockets when using the Lettuce driver. Domain sockets do not require a roundtrip through the networking layer but directly use native epoll or kqueue interfaces.
LettuceConnectionFactory factory = new LettuceConnectionFactory(new RedisSocketConfiguration("/var/run/redis.sock"));
Unix domain socket support requires netty's native epoll/kqueue dependencies matching the runtime environment:
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<version>${netty}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<classifier>osx-x86_64</classifier>
<version>${netty}</version>
</dependency>
Original Pull Request: #286
We now reuse the initially created map and add or replace initial configurations in place instead of creating each time a new map.
Original pull request: #293.
Adapt Lettuce implementation to use async commands in transaction mode. Adapt tests to changed behavior of returning status responses. Extend Javadoc.
Original pull request: #284.
We now reuse a shared Lettuce connection across our reactive connection wrappers if LettuceConnectionFactory is configured to provide a shared connection instance. Reactive connections can either operate with a shared connection or with a connection provider only.
We also now execute blocking Redis commands (BLPOP, BRPOP, BRPOPLPUSH) on dedicated connection.
Original Pull Request: #290
We now use the asynchronous API to dispatch commands within a transaction using the Lettuce driver. This allows us dropping our additional result wrappers and use a single, uniform api for deferred results.
Original pull request: #289.
Fix generics for accepted Future, Supplier and Converter. Introduce generics for status responses. Add Javadoc, use synchronous API for exists call.
Original pull request: #289.
We now encapsulate deferred results for pipelining and transactions entirely within FutureResult and its subtypes. FutureResult accepts a Supplier<T> for default values, if operations return null and reports whether its result requires conversion. JedisResult and LettuceResult are now top-level classes and no longer inner classes of their connection factories.
Original pull request: #289.
Provide a String-focused convenience class for simpler bootstrapping and to provide a dedicated bean type for the application context when using auto-configuration.
Original Pull Request: #288
We now allow configuration of the client name that is applied to connections using the Lettuce driver.
LettuceClientConfiguration configuration = LettuceClientConfiguration.builder().clientName("foo-bar").build();
LettuceConnectionFactory factory = new LettuceConnectionFactory(new RedisStandaloneConfiguration(), configuration);
Fixed some typos, javadoc and method visibility along the way.
Original Pull Request: #285
Add dedicated section on executing lua scripts via the reactive infrastructure, rephrase some other parts adapt non-Javadoc comments to code style.
Original Pull Request: #280