Commit Graph

604 Commits

Author SHA1 Message Date
Mark Paluch
a2bc45cfa2 DATAREDIS-830 - Release Pub/Sub connection when closing LettuceSubscription.
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
2018-05-22 12:37:32 +02:00
Christoph Strobl
03c607a337 DATAREDIS-743 - Polishing.
Update Javadoc and comments.

Original Pull Request: #343
2018-05-22 10:46:06 +02:00
Mark Paluch
ee3c1bd9f8 DATAREDIS-743 - Polishing.
Add Javadoc. Improve ScanOptions builder.

Original Pull Request: #343
2018-05-22 10:45:08 +02:00
Mark Paluch
d4b06c2984 DATAREDIS-743 - Add Reactive SCAN, HSCAN, SSCAN, and ZSCAN support.
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
2018-05-22 10:43:37 +02:00
Christoph Strobl
9b18499b5e DATAREDIS-778 - Align return types of BoundZSetOperations with ZSetOperations.
This is a binary breaking change that requires code using BoundZSetOperations to recompile.

Original pull request: #338.
2018-05-15 15:02:20 +02:00
Christoph Strobl
90f0685cb7 DATAREDIS-824 - Polishing.
Split and add integration tests.

Original Pull Request: #340
2018-05-04 14:02:54 +02:00
Yin Jifeng
2c1ee77b87 DATAREDIS-824 - Fix potential NPE in DefaultReactiveHashOperations when deserializing values.
Avoid ByteBuffer creation for null values indicating absent keys in hash.

Original Pull Request: #340
2018-05-04 14:02:45 +02:00
Mark Paluch
d2871ec032 DATAREDIS-562 - Add reactive BitField support.
Original pull request: #227.
2018-05-03 15:24:23 +02:00
Mark Paluch
10f8553c5a DATAREDIS-562 - Polishing.
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.
2018-05-03 15:24:23 +02:00
Christoph Strobl
41db6a10fe DATAREDIS-562 - Add support for BITFIELD.
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.
2018-05-03 15:24:23 +02:00
佳何 蔡
e631352832 DATAREDIS-819 - Fix Javadoc in ReactiveValueOperations.
Original Pull Request: #336
2018-05-03 14:01:05 +02:00
Mark Paluch
0955a4fea6 DATAREDIS-716 - Polishing.
Add OBJECT command support for Jedis Cluster.

Original pull request: #337.
2018-05-02 18:09:53 +02:00
Christoph Strobl
70a3e5dbe7 DATAREDIS-716 - Add support for OBJECT REFCOUNT, ENCODING and IDLETIME.
Original pull request: #337.
2018-05-02 15:53:24 +02:00
Mark Paluch
f8d63f4736 DATAREDIS-822 - Consider argument range in RedisCommand min/max arguments specification.
We now consider max argument specifications as upper bound and no longer as the exact number of required arguments.

Original pull request: #335.
2018-05-02 14:49:24 +02:00
Mark Paluch
abb7d9f684 DATAREDIS-697 - Polishing.
Extract Range value access to methods. Remove unused imports. Add type hint for BITPOS via execute(…).

Original pull request: #335.
2018-05-02 14:31:23 +02:00
Christoph Strobl
e9a3a5b6d9 DATAREDIS-697 - Add support for BITPOS.
We now support the BITPOS command throughout the sync and reactive api.

Original pull request: #335.
2018-05-02 14:31:09 +02:00
Christoph Strobl
8215f68d9f DATAREDIS-815 - Polishing.
Update Javadoc, add tests and missing methods for BoundValueOperations.

Original Pull Request: #334
2018-04-26 14:58:26 +02:00
Mark Paluch
e5b14193d4 DATAREDIS-815 - Add method variants accepting/returning java.time.Duration.
Original Pull Request: #334
2018-04-26 14:11:34 +02:00
Christoph Strobl
f1be9b736d DATAREDIS-786 - Polishing.
Update Javadoc and add setIfPresent to BoundValueOperations.

Original Pull Request: #334
2018-04-26 14:10:15 +02:00
Mark Paluch
2c11a1c402 DATAREDIS-786 - Add ValueOperations.setIfPresent(…).
We now expose setIfPresent(…) through ValueOperations.

Original Pull Request: #334
2018-04-26 14:00:49 +02:00
Christoph Strobl
16f7a445ba DATAREDIS-612 - Polishing.
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
2018-04-26 09:27:34 +02:00
Mark Paluch
a3b96add06 DATAREDIS-612 - Polishing.
Introduce factory methods for ChannelTopic and PatternTopic.

Original Pull Request: #295
2018-04-26 09:20:04 +02:00
Mark Paluch
4b80acf7f5 DATAREDIS-612 - Send and receive Pub/Sub messages using reactive connections.
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
2018-04-26 09:17:19 +02:00
Christoph Strobl
e090d4cb7c DATAREDIS-763 - Polishing.
Update Javadoc.

Original Pull Request: #333
2018-04-25 13:45:49 +02:00
Mark Paluch
8ea74fb7b3 DATAREDIS-763 - Introduce factory methods for JDK serializer accepting ClassLoader.
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
2018-04-25 13:45:17 +02:00
Mark Paluch
7a79f2c34f DATAREDIS-544 - Polishing.
Remove unused ClassNameKeySpaceResolver.

Original Pull Request: #329
2018-04-11 10:48:35 +02:00
Mark Paluch
58d7ff90a5 DATAREDIS-544 - Read constructor property values through MappingRedisConverter.
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
2018-04-11 10:48:08 +02:00
Mark Paluch
9ede7b317e DATAREDIS-810 - Adapted to API changes in Spring Data Commons.
Related ticket: DATACMNS-1275.
2018-04-10 15:35:15 +02:00
Yanming Zhou
3c9cbe171f DATAREDIS-809 - Fix Javadoc.
Original pull request: #328.
2018-04-09 15:30:53 +02:00
Mark Paluch
3e9d610228 DATAREDIS-803 - Polishing.
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.
2018-04-09 09:31:21 +02:00
Christian Bühler
8ed4703d46 DATAREDIS-803 - Retrieve DefaultRedisMap.entrySet() via HGETALL.
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.
2018-04-09 09:31:21 +02:00
Mark Paluch
7e3ba99e29 DATAREDIS-791 - Polishing.
Migrate tests to use StepVerifier instead of block(). Simplify isUpsert() comparison.

Original Pull Request: #325
2018-04-03 10:48:24 +02:00
Mark Paluch
2902d3fb4a DATAREDIS-791 - Disable ifValueNotExists() flag in ReactiveHashCommands.hMSet.
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
2018-04-03 10:46:46 +02:00
Christoph Strobl
4a064c5ad0 DATAREDIS-762 - Polishing.
Introduce marker interface RedisConfiguration along with several others providing access to specific setup scenarios like cluster and sentinel.

Original Pull Request: #306
2018-03-20 12:30:59 +01:00
Mark Paluch
bb990b14ae DATAREDIS-762 - Add AWS ElastiCache configuration.
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
2018-03-20 12:29:48 +01:00
Christoph Strobl
c156c82cf0 DATAREDIS-545 - Polishing.
Format source and use dedicated getClient() method to obtain the clusterClient.

Original Pull Request: #297
2018-03-16 13:32:18 +01:00
Mark Paluch
155f45c376 DATAREDIS-545 - Support connection-pooling for Redis Cluster with Lettuce.
We now support connection pooling for Cluster connections using Lettuce.

Original Pull Request: #297
2018-03-16 13:31:53 +01:00
Mark Paluch
a3d4e4f771 DATAREDIS-731 - Polishing.
Document undocumented parameter. Fix typo.

Original Pull Request: #297
2018-03-16 13:31:28 +01:00
Mark Paluch
b656b09db5 DATAREDIS-731 - Share native Lettuce Cluster connection across LettuceClusterConnection.
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
2018-03-16 13:31:02 +01:00
Christoph Strobl
09bd48c245 DATAREDIS-635 - Polishing.
Update Javadoc and format code a bit.

Original Pull Request: #296
2018-03-16 10:09:58 +01:00
Mark Paluch
c18a311aa9 DATAREDIS-635 - Add keyspace scanning using Redis Cluster.
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
2018-03-16 10:09:21 +01:00
Mark Paluch
79dd124abc DATAREDIS-784 - Polishing.
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.
2018-03-14 11:48:36 +01:00
Jiahe Cai (佳何 蔡)
8857f96b9f DATAREDIS-784 - Add support for reactive increment and decrement commands to ReactiveValueOperations.
We now support reactive execution of the following increment and decrement commands through ReactiveValueOperations:

- INCR
- INCRBY
- INCRBYFLOAT
- DECR
- DECRBY

Original pull request: #322.
2018-03-14 11:48:36 +01:00
Christoph Strobl
452feb9420 DATAREDIS-543 - Polishing.
Move BucketPropertyPath to Bucket.

Original Pull Request: #299
2018-03-14 10:40:00 +01:00
Mark Paluch
9969a559ea DATAREDIS-543 - Polishing.
Cleanup references to MongoDB.

Original Pull Request: #299
2018-03-14 10:40:00 +01:00
Mark Paluch
04153e07b0 DATAREDIS-543 - Allow customized type aliasing.
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
2018-03-14 10:40:00 +01:00
Jiahe Cai (佳何 蔡)
f3128bf0c0 DATAREDIS-783 - Fix typo in LettuceReactiveRedisConnection.
Original pull request: #321.
2018-03-14 10:23:31 +01:00
Mark Paluch
50c24f69d1 DATAREDIS-782 - Polishing.
Add setIfPresent(…) with expiry to reactive API. Add since tags, minor tweaks to javadoc and tests.

Original pull request: #320.
2018-03-14 10:15:50 +01:00
Jiahe Cai (佳何 蔡)
a2ed8e1d9b DATAREDIS-782 - Add support for SET key value NX EX max-lock-time.
We now expose ValueOperations.setIfAbsent(…) to set values when absent along their expiry.

Original pull request: #320.
2018-03-14 10:15:46 +01:00
Mark Paluch
567fa43e60 DATAREDIS-785 - Export composable repositories via CDI.
We now export composable repositories through our CDI extension. Repositories can now be customized either by a single custom implementation (as it was before) and by providing fragment interfaces along their fragment implementation.

This change aligns CDI support with the existing RepositoryFactory support we provide within a Spring application context.
2018-03-12 16:41:04 +01:00