We now support IsTrue and IsFalse keywords usage in repository query methods to create queries with predicates for boolean fields values without requiring to pass a boolean argument.
class Person {
@Id String id;
@Indexed Boolean alive;
}
interface PersonRepository extends Repository<Person, String> {
Person findByAliveIsTrue();
Person findByAliveIsFalse();
}
Original Pull Request: #342
We now release the native connection back to the connection provider when LettuceSubscription is closed. Previously, we just closed the connection which interfered with pooling as pooling connection providers still had a reference on the connection.
Original Pull Request: #341
We now provide reactive SCAN support for keys, hashes, sets, and sorted sets. Scanning uses a cursor-based Flux and takes subscriber demand into account to issue the according scan commands once a batch of keys/values/entries was emitted. Specifying a SCAN limit controls the batch (page) size and can be used to optimize the number of roundtrips between the application and Redis.
Original Pull Request: #343
Move BitfieldCommand to top-level type BitFieldSubCommands.
Use primitives in command objects. Add toString methods. Add utility methods to extract responses from Jedis Client. Use Connection.execute(…) to invoke BITFIELD using Jedis. Fix Overflow values to string rendering.
Convert test ticket references to new format.
Original pull request: #227.
We now offer support for BITFIELD via RedisConnection and RedisClusterConnection using Lettuce and Jedis.
connection.bitField(key,
create()
.set(INT_8).valueAt(offset(0).multipliedByTypeLength()).to(100)
.incr(signed(8)).valueAt(offset(102)).overflow(FAIL).by(1));
Original pull request: #227.
Introduce dedicated methods utilizing the ReactiveMessageListenerContainer to create a stream of Messages via ReactiveRedisTemplate.
redisTemplate.listenToChannel("channel1", "channel2").doOnNext(msg -> {
// message processing ...
}).subscribe();
Add close-/destroyLater methods avoiding blocking shutdown of connections and containers.
Original Pull Request: #295
We now provide sending and receiving of Redis Pub/Sub messages with reactive connections. Messages can be sent with ReactiveRedisTemplate and received as infinite stream through ReactiveRedisMessageListenerContainer. ReactiveRedisMessageListenerContainer uses a single connection to multiplex different subscriptions.
Reactive Pub/Sub supports Standalone, Sentinel and Redis Cluster setups.
ReactiveRedisConnectionFactory factory = …;
ReactiveRedisTemplate<String, String> template = new ReactiveRedisTemplate<>(factory, RedisSerializationContext.string());
Mono<Long> publish = template.convertAndSend("hello!", "world");
ReactiveRedisMessageListenerContainer container = new ReactiveRedisMessageListenerContainer(factory);
Flux<ChannelMessage<String, String>> channelMessages = container.receive(new ChannelTopic("foo"));
Flux<PatternMessage<String, String, String>> patternMessages = container.receive(new PatternTopic("foo"));
//
container.destroy();
Original Pull Request: #295
We now provide factory methods to create default serializers/deserializers accepting ClassLoader.
RedisSerializer.java(ClassLoader)
RedisSerializationContext.java(ClassLoader)
RedisCacheConfiguration.defaultCacheConfig(ClassLoader)
Original Pull Request: #333
We now read and convert constructor property values through MappingRedisConverter.readProperty(…) to apply proper conversion. This way, constructor properties are read through the same methods as instance properties allowing to read back nested level entities.
Previously, we were only reading simple properties or properties associated with a registered Converter.
Original Pull Request: #329
Remove DefaultRedisMapEntry as it's no longer required. Simplify test to unit test to reduce test scope and test run time.
Original pull request: #326.
Redis has a limitation of 1024 * 1024 parameters]() for bulk operations.
To receive more than 1024 * 1024 - 1 entries with entrySet(), we can directly use the HGETALL command instead of first fetching the keys with HKEYS and then fetching the values with HMGET.
See also: https://github.com/antirez/redis/blob/4.0.9/src/networking.c#L1200
Original pull request: #326.
We now no longer set ifValueNotExists() in ReactiveHashCommands.hMSet to always upsert hash entries. Previously, we called HSETNX if hMSet was called with a single tuple which did not overwrite existing entries.
Align return value of hMSet to return always true as calling internally HSET returns 1 only on newly set hash fields and setting an existing field resulted previously in false.
Original Pull Request: #325
Introduce marker interface RedisConfiguration along with several others providing access to specific setup scenarios like cluster and sentinel.
Original Pull Request: #306
We now provide RedisElastiCacheConfiguration to configure connections to AWS ElastiCache for Redis services with optional read replicas.
RedisElastiCacheConfiguration elastiCache = new RedisElastiCacheConfiguration("redis-node-1.elasticache.aws.com")
.node("redis-node-2.elasticache.aws.com");
LettuceConnectionFactory factory = new LettuceConnectionFactory(elastiCache, configuration);
Original Pull Request: #306
We now share Lettuce Cluster connections if configured on LettuceConnectionFactory (enabled by default) across multiple LettuceClusterConnections. Connection sharing prevents creation and disposal of cluster connections per template command execution which improves overall performance.
Original Pull Request: #297
We now support SCAN commands with Redis Cluster. Cluster-wide scanning is supported with Lettuce only and SCAN on a selected node works with both clients.
// Lettuce only
Cursor<byte[]> scan = clusterConnection.scan(ScanOptions.NONE);
// Jedis and Lettuce
Cursor<byte[]> scan = clusterConnection.scan(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), ScanOptions.NONE);
Original Pull Request: #296
Rename incrementBy and decrementBy to increment respective decrement. Use INCR and DECR for increment() and decrement() instead of INCRBY 1/INCRYBY -1. Rearrange method order to align with method order in ReactiveValueOperations. Tweak Javadoc, add since tags.
Introduce increment() and decrement(…) (as of INCR/DECR) to ValueOperations and BoundValueOperations and use ValueOperations.increment()/decrement() from RedisAtomicInteger. ValueOperations used INCRBY and DECRBY to increment and now we use the native command if methods without delta are invoked.
Original pull request: #322.
We now support reactive execution of the following increment and decrement commands through ReactiveValueOperations:
- INCR
- INCRBY
- INCRBYFLOAT
- DECR
- DECRBY
Original pull request: #322.
We now support customization of type aliasing for types using through Redis Repositories. Type aliasing can be customized by either annotating types with @TypeAlias or by providing a RedisTypeMapper to MappingRedisConverter.
Map<Class<?>, String> mapping = new HashMap<>();
mapping.put(Person.class, "person");
ConfigurableTypeInformationMapper mapper = new ConfigurableTypeInformationMapper(mapping);
RedisTypeMapper typeMapper = new DefaultRedisTypeMapper(DefaultRedisTypeMapper.DEFAULT_TYPE_KEY, Collections.singletonList(mapper))
alternatively:
@RedisHash
@TypeAlias("person")
class Person {
// …
}
Original Pull Request: #299