Commit Graph

759 Commits

Author SHA1 Message Date
Mark Paluch
a525fc1fd9 Add ScanOptions.pattern(…) accepting a byte[] pattern.
We now accept a byte array as pattern for scan operations in addition to String patterns.

Also, use binary Jedis scan method to avoid bytes to String conversion.

Closes: #2006
Original Pull Request: #2051
2021-05-20 13:01:57 +02:00
Mark Paluch
b4e75e5f96 Guard non-initialized RedisConnectionFactory.getConnection() with IllegalStateException.
Obtaining a Connection from RedisConnectionFactory and its reactive variant is now guarded by IllegalStateException that is thrown if the connection factory was not yet initialized.

Previously, connections could be obtained where configuration was partially applied.

Closes #2057
2021-05-12 11:56:32 +02:00
Mark Paluch
6d719a4292 Add test to verify RedisCache.clear().
See #2028.
2021-04-13 11:22:21 +02:00
Mark Paluch
284dfbcca6 Adapt to changes in Jedis 3.6.
Closes #2017
Original Pull Request: #2021
2021-03-31 15:00:06 +02:00
Mark Paluch
0f6a152295 Polishing.
Reorder methods. Move rewriteConfig directly implemented on connection to DefaultedRedisConnection respective DefaultedRedisClusterConnection.

Add overload to run config rewrite on individual cluster nodes. Add tests. Add since tags and update Javadoc.

See #1992
Original pull request: #2012.
2021-03-29 11:40:51 +02:00
Manousos Mathioudakis
2d56eaf3c6 Add support for CONFIG REWRITE.
Signed-off-by: Manousos Mathioudakis <manoumathioudakis@yahoo.gr>

Closes #1992
Original pull request: #2012.
2021-03-29 11:40:50 +02:00
Christoph Strobl
3a1fbe1cf7 Remove limit(long) from Cursor and hint users to stream().limit(...)
Original Pull Request: #2014
2021-03-25 13:11:53 +01:00
Mark Paluch
0061d6c7af Polishing.
Let Cursor extend CloseableCursor. Refine nullability annotations and align nullability behavior in tests with actual nullability usage.

See: #1575
Original Pull Request: #2014
2021-03-25 12:48:09 +01:00
Mark Paluch
b7f2d68d73 Add limit option to ScanCursor.
ScanCursor can be now limited to a maximum number of elements to be retrieved.

Closes: #1575
Original Pull Request: #2014
2021-03-25 12:47:21 +01:00
Mark Paluch
d5ba93cc25 Pass-thru byte arrays in entities into Bucket.
MappingRedisConverter now accepts data for byte arrays as single property to avoid flattening out binary data into a collection form. We still accept data in a collection form to retain compatibility.

Closes: #1981
Original Pull Request: #2015
2021-03-25 09:22:00 +01:00
Christoph Strobl
b2349fd1ea Guard tests when no cluster available.
See #1711
Original Pull Request: #1977
2021-03-24 13:49:51 +01:00
Christoph Strobl
7207305637 Update state check error message to include failure hint.
Original Pull Request: #2013
2021-03-24 13:49:01 +01:00
Mark Paluch
73650cf943 Return AbstractRedisClient from LettuceConnectionFactory.
Closes #1745
Original Pull Request: #2013
2021-03-24 13:48:49 +01:00
Mark Paluch
503d639c5d Make RedisConnectionProxy public.
RedisConnectionProxy is now public so it can be used properly for Java proxy creation across different class loaders. Previously, creating a Java proxy from a different class loader failed because of visibility/access restrictions.

Closes #2016
2021-03-24 09:33:02 +01:00
Mark Paluch
9b39c09389 Polishing.
Add support for Jedis Streams using JedisCluster. Add fromMany(…) for non-pipelined usage to JedisInvoker.

Reformat code, add author tags. Extract Jedis-specific stream type converters to StreamConverters. Properly convert StreamEntry and StreamEntryID into list/map. Update tests.

See #1711
Original pull request: #1977.
2021-03-16 09:45:06 +01:00
dengliming
a31c739ab6 Add support to Redis Streams using Jedis.
Closes #1711
Original pull request: #1977.
2021-03-16 09:44:53 +01:00
Mark Paluch
654b2284ed Polishing.
Add integration tests for Lettuce Cluster zRevRangeByLex. Fix converter usage in tests.

See #1998
2021-03-15 17:30:59 +01:00
Mark Paluch
4dd5a7a4fa Fix JedisClusterZSetCommands.reverseRangeByLex(…) parameter order.
max/min parameter are now used in the correct order.

Closes #1998
2021-03-15 17:30:59 +01:00
Christoph Strobl
04dae74c8b Update JavaDoc.
Original Pull Request: #1996
2021-03-15 08:31:09 +01:00
Mark Paluch
e496c19021 Consider target type when calling getAllOf(…).
We now accept a type hint when calling getAllOf(…) to avoid materializing null instances when the actual type hint cannot resolve to an entity.

Closes #1995
Original Pull Request: #1996
2021-03-15 08:30:55 +01:00
Mark Paluch
b5ea3f6826 Accept cluster nodes without hostname.
RedisNode can now be constructed using an empty hostname. This can happen when a node is in failover state. RedisNode exposes hasValidHost() to check whether the node has a valid hostname.

Also, introduce copy constructor to avoid mutations caused by the builder.

Closes #1985
Original Pull Request: #1991
2021-03-08 10:09:56 +01:00
Christoph Strobl
4d77392c9d Support ZADD params for Reactive-/RedisConnection and add addIfAbsent methods.
Closes: #1794
Original pull request: #1988.
2021-03-03 10:10:39 +01:00
Mark Paluch
102ee017aa Add support for microseconds using TIME.
Closes #526.
Original pull request: #526.
2021-03-03 09:34:27 +01:00
Mark Paluch
773acd09b2 Pass-thru custom Redis commands using Lettuce.
We now accept unknown custom Redis commands when using the Lettuce driver. Previously, custom commands were required to exist in Lettuce's CommandType enumeration and unknown commands (such as modules) failed to run.

Closes #1979
2021-02-23 09:38:10 +01:00
Christoph Strobl
4df8e44818 Move expires check to dedicated method.
Introduce helper method to unify expiry check and simplify control flow.

Original Pull Request: #1961
2021-02-16 11:52:40 +01:00
Muchnik Andrey
e46246721f Remove phantom copy of expiring data when source gets persisted.
This commit makes sure to clean up resources when a previously expiring entity is persisted by setting the time to live to zero or negative.
In case a phantom copy exists for the changed entity, it is removed to free space on the server and prevent expiration events from being sent.

Closes #1955
Original Pull Request: #1961
2021-02-16 11:51:41 +01:00
Mark Paluch
febdb82e58 Polishing.
Reformat code. Tweak Javadoc

See #1816.
Original pull request: #1968.
2021-02-15 14:56:49 +01:00
Christoph Strobl
507a882e93 Add support for ZREMRANGEBYLEX.
We now support ZREMRANGEBYLEX for Synchronous, Reactive, ZSetOperations and RedisZSet.

Also provide a Kotlin coroutines variant via the extension for ReactiveZSetOperations.

Closes #1816.
Original pull request: #1968.
2021-02-15 14:56:39 +01:00
Christoph Strobl
840c7f50ca Fix LPOS when member not in list.
This commit ensures an empty List is returned in the case the member does not exist in the target list.

See #1957.
Original pull request: #1962.
2021-02-15 14:40:58 +01:00
Christoph Strobl
19eb0930cd Support LPOS command via Jedis.
This commit introduces support for the LPOS command when using the Jedis Redis driver.

Closes #1957.
Original pull request: #1962.
2021-02-15 14:40:52 +01:00
Mark Paluch
7e7197b087 Upgrade to Lettuce 6.1.0 M1.
Fix test to use closed range as Lettuce 6.1/Redis 6.2 distinguish now between inclusive and exclusive bounds.

Closes #1967.
2021-02-15 09:54:40 +01:00
Mark Paluch
c7eef8fcff Introduce JedisInvoker.
We now use JedisInvoker to call Jedis and Pipeline methods for synchronous, pipelining, and transactional execution models. JedisInvoker captures the method invocation as functional utility and allows conversion of results:

Long result = invoker.just(BinaryJedis::geoadd, MultiKeyPipelineBase:geoadd, key, point.getX(), point.getY(), member);

Closes #1951
Original Pull Request: #1960
2021-02-10 09:58:59 +01:00
Mark Paluch
96fa2ecd70 Introduce LettuceInvoker.
We now use LettuceInvoker to call Lettuce API methods for synchronous, pipelining, and transactional execution models. LettuceInvoker captures the method invocation as functional utility and allows conversion of results:

Long result = invoker.just(RedisGeoAsyncCommands::geoadd, key, point.getX(), point.getY(), member);

List<byte[]> result = invoker.fromMany(RedisGeoAsyncCommands::geohash, key, members)
 				.toList(it -> it.getValueOrElse(null));

Closes #1797
Original Pull Request #1948
2021-01-26 16:54:33 +01:00
Mark Paluch
501de9c1fa Update copyright year to 2021.
Closes #1942
2021-01-12 10:44:09 +01:00
Mark Paluch
a5700ba71a DATAREDIS-1230 - Revise error handling in StreamReceiver and StreamMessageListenerContainer.
Reading and deserialization in StreamReceiver and StreamMessageListener is now decoupled from each other to allow fine-grained control over errors and resumption.

Previously, we used the Template API to read and deserialize stream records. Now the actual read happens before the deserialization so that errors during deserialization of individual messages can be handled properly. This split also allows advancing in the stream read. Previously, the failed deserialization prevented of getting hold of the non-serialized Stream record which caused the stream receiver to remain at the offset that fetched the offending record which effectively lead to an infinite loop.

We also support a resume function in StreamReceiver to control whether stream reads should be resumed or terminated.

Original Pull Request: #576
2020-12-07 11:10:50 +01:00
Christoph Strobl
7d2bf8f852 DATAREDIS-891 - Update documentation.
Update since tags, add issue reference and fix new line issues in reference documentation.

Original Pull Request: #573
2020-12-07 10:12:52 +01:00
Mark Paluch
1912d0c999 DATAREDIS-891 - Revise RedisConnection transaction/closure resource binding.
We now correctly consider the transactional state along with the requested bindings scope when binding RedisConnection for reuse.

Previously, enabling transaction support on RedisTemplate registered the connection unconditionally with TransactionSynchronizationManager expecting a TransactionManager to close/unbind the connection upon transaction cleanup. This behavior could easily lead to lingering connections when a transactional RedisTemplate was used outside of a managed transaction.

We now distinguish between closure-scope binding and transaction binding.

Closure-scoped bindings (RedisTemplate.execute(SessionCallback)) do not interfere with transactional resources if there's no transactionally bound RedisConnection.

Closure-scope however reuses a transactionally bound connection.

Transaction-scoped binding binds only a connection to the transaction if there's an active transaction. Without an ongoing transaction, RedisTemplate does no longer bind connections to TransactionSynchronizationManager.

Original Pull Request: #573
2020-12-07 10:12:19 +01:00
Mark Paluch
79e9ad310e DATAREDIS-1248 - Use fresh JedisConnectionFactory in PubSubTests.
We make sure to use a dedicated JedisConnectionFactory for Pub/Sub tests as connections can easily break in previous tests which causes connection synchronization issues in the connection itself and in consequence, tests fail with an unrelated cause.
2020-11-11 10:25:08 +01:00
Mark Paluch
366b5ffd25 DATAREDIS-1245 - Consider List subtypes used with RedisScript as MULTI return type.
We now consider List and subtypes of List to be returned as MULTI return type. Previously, List subtypes were considered to represent the value type.

Original Pull Request: #571
2020-11-10 12:03:51 +01:00
Christoph Strobl
6991310106 DATAREDIS-1233 - Polishing.
Update license header, use early return for if statements and guard tests against failure when running against a single node instance.
2020-10-26 10:43:38 +01:00
Mark Paluch
fff1d3e691 DATAREDIS-1233 - Introduce and use Junit5 based ParameterizedRedisTest. 2020-10-26 10:43:24 +01:00
Mark Paluch
2511aa18c0 DATAREDIS-1233 - Add JUnit 5 extensions. 2020-10-26 10:32:22 +01:00
Mark Paluch
7d2e899092 DATAREDIS-1234 - Report Redis version 6.0.6+ in tests.
Original Pull Request: #570
2020-10-23 13:03:09 +02:00
Mark Paluch
8e4f796309 DATAREDIS-1234 - Consistently return List<Long> from LPOS command.
We now convert pipeline/transaction results to List<Long> to ensure a consistent return type.

Original Pull Request: #570
2020-10-23 13:02:39 +02:00
Mark Paluch
7f9de716c8 DATAREDIS-1212 - Polishing.
Remove overly pessimistic null checks. Use constant when channel/body are empty to avoid allocations. Remove superfluous final keywords.

Original pull request: #559.
2020-10-16 13:49:55 +02:00
Mark Paluch
1964ed15c6 DATAREDIS-729 - Polishing.
Reorder methods so lexCount(…) comes after count(…). Tweak Javadoc wording. Simplify tests.

Original pull request: #569.
2020-10-14 09:49:04 +02:00
anshlykov
bd1332ec5c DATAREDIS-729 - Add support for ZLEXCOUNT.
Original pull request: #569.
2020-10-14 09:47:14 +02:00
Mark Paluch
4b33a62f64 DATAREDIS-1231 - Polishing.
Add author tag.

Fix typos in test method names.

Original pull request: #568.
2020-10-13 16:07:53 +02:00
Mark Paluch
41136c6934 DATAREDIS-729 - Expose reverseRangeByLex methods on Template API.
Also, switch methods to default methods where applicable.

Original pull request: #566.
2020-10-13 12:38:28 +02:00
Mark Paluch
df37dc812b DATAREDIS-729 - Polishing.
Tweak assertion messages and consistently use constants. Reformat code. Join assertions in tests.

Original pull request: #566.
2020-10-13 12:14:01 +02:00