diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml index edc2911f43..4607da071c 100644 --- a/.github/release-drafter-config.yml +++ b/.github/release-drafter-config.yml @@ -1,5 +1,7 @@ name-template: '$NEXT_MINOR_VERSION' tag-template: 'v$NEXT_MINOR_VERSION' +filter-by-commitish: true +commitish: master autolabeler: - label: 'maintenance' files: @@ -35,6 +37,8 @@ categories: labels: - 'maintenance' - 'dependencies' + - 'documentation' + - 'docs' - 'testing' change-template: '- $TITLE (#$NUMBER)' exclude-labels: diff --git a/.github/workflows/doctests.yml b/.github/workflows/doctests.yml index 8122b40b20..daa8858b89 100644 --- a/.github/workflows/doctests.yml +++ b/.github/workflows/doctests.yml @@ -2,6 +2,8 @@ name: Documentation Tests on: push: + tags-ignore: + - '*' pull_request: workflow_dispatch: @@ -32,4 +34,4 @@ jobs: distribution: 'temurin' - name: Run doctests run: | - mvn -Pdoctests test \ No newline at end of file + mvn -Pdoctests test diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e6907dcaef..84da5938f6 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,15 +10,16 @@ on: - '**/*.rst' branches: - master - - '[0-9].[0-9]' - '[0-9].x' + - '[0-9].[0-9].x' pull_request: branches: - master - - '[0-9].[0-9]' - '[0-9].x' + - '[0-9].[0-9].x' schedule: - cron: '0 1 * * *' # nightly build + workflow_dispatch: jobs: diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 6c8ad1a962..8a409b8331 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -6,7 +6,8 @@ on: push: branches: - master - - '[0-9].[0-9]' + - '[0-9].x' + workflow_dispatch: jobs: diff --git a/.github/workflows/version-and-release.yml b/.github/workflows/version-and-release.yml index 007d8875e8..7c996e5bd5 100644 --- a/.github/workflows/version-and-release.yml +++ b/.github/workflows/version-and-release.yml @@ -16,7 +16,7 @@ jobs: run: | realversion="${GITHUB_REF/refs\/tags\//}" realversion="${realversion//v/}" - echo "::set-output name=VERSION::$realversion" + echo "VERSION=$realversion" >> $GITHUB_OUTPUT - name: Set up publishing to maven central uses: actions/setup-java@v2 @@ -32,14 +32,14 @@ jobs: - name: Install gpg key run: | - cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import + cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - name: Publish run: | mvn --no-transfer-progress \ --batch-mode \ - -Dgpg.passphrase='${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}' \ + -Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \ -DskipTests deploy -P release env: MAVEN_USERNAME: ${{secrets.OSSH_USERNAME}} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..15c4dd523a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2023, Redis, inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 7b8b1cee63..0000000000 --- a/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2010 Jonathan Leibiusky - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile index 2987ad80dd..6e63f1b6ce 100644 --- a/Makefile +++ b/Makefile @@ -209,7 +209,7 @@ daemonize yes protected-mode no requirepass cluster port 7379 -cluster-node-timeout 50 +cluster-node-timeout 15000 pidfile /tmp/redis_cluster_node1.pid logfile /tmp/redis_cluster_node1.log save "" @@ -223,7 +223,7 @@ daemonize yes protected-mode no requirepass cluster port 7380 -cluster-node-timeout 50 +cluster-node-timeout 15000 pidfile /tmp/redis_cluster_node2.pid logfile /tmp/redis_cluster_node2.log save "" @@ -237,7 +237,7 @@ daemonize yes protected-mode no requirepass cluster port 7381 -cluster-node-timeout 50 +cluster-node-timeout 15000 pidfile /tmp/redis_cluster_node3.pid logfile /tmp/redis_cluster_node3.log save "" @@ -251,7 +251,7 @@ daemonize yes protected-mode no requirepass cluster port 7382 -cluster-node-timeout 50 +cluster-node-timeout 15000 pidfile /tmp/redis_cluster_node4.pid logfile /tmp/redis_cluster_node4.log save "" @@ -265,7 +265,7 @@ daemonize yes protected-mode no requirepass cluster port 7383 -cluster-node-timeout 5000 +cluster-node-timeout 15000 pidfile /tmp/redis_cluster_node5.pid logfile /tmp/redis_cluster_node5.log save "" diff --git a/README.md b/README.md index b853aadd96..4c7c507d21 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt) [![Integration](https://github.com/redis/jedis/actions/workflows/integration.yml/badge.svg?branch=master)](https://github.com/redis/jedis/actions/workflows/integration.yml) [![codecov](https://codecov.io/gh/redis/jedis/branch/master/graph/badge.svg?token=pAstxAAjYo)](https://codecov.io/gh/redis/jedis) -[![Discord](https://img.shields.io/discord/697882427875393627?style=flat-square)](https://discord.gg/qRhBuY8Z) +[![Discord](https://img.shields.io/discord/697882427875393627?style=flat-square)](https://discord.gg/redis) ## What is Jedis? @@ -14,25 +14,37 @@ Jedis is a Java client for [Redis](https://github.com/redis/redis "Redis") desig Are you looking for a high-level library to handle object mapping? See [redis-om-spring](https://github.com/redis/redis-om-spring)! -## Contributing +## How do I Redis? -We'd love your contributions! +[Learn for free at Redis University](https://university.redis.com/) -**Bug reports** are always welcome! [You can open a bug report on GitHub](https://github.com/redis/jedis/issues/new). +[Build faster with the Redis Launchpad](https://launchpad.redis.com/) -You can also **contribute documentation** -- or anything to improve Jedis. Please see -[contribution guideline](https://github.com/redis/jedis/blob/master/.github/CONTRIBUTING.md) for more details. +[Try the Redis Cloud](https://redis.com/try-free/) + +[Dive in developer tutorials](https://developer.redis.com/) + +[Join the Redis community](https://redis.com/community/) + +[Work at Redis](https://redis.com/company/careers/jobs/) ## Supported Redis versions -The most recent version of this library supports redis version [5.0](https://github.com/redis/redis/blob/5.0/00-RELEASENOTES), [6.0](https://github.com/redis/redis/blob/6.0/00-RELEASENOTES), [6.2](https://github.com/redis/redis/blob/6.2/00-RELEASENOTES), and [7.0](https://github.com/redis/redis/blob/7.0/00-RELEASENOTES). +The most recent version of this library supports redis version +[5.0](https://github.com/redis/redis/blob/5.0/00-RELEASENOTES), +[6.0](https://github.com/redis/redis/blob/6.0/00-RELEASENOTES), +[6.2](https://github.com/redis/redis/blob/6.2/00-RELEASENOTES), +[7.0](https://github.com/redis/redis/blob/7.0/00-RELEASENOTES) and +[7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES). The table below highlights version compatibility of the most-recent library versions and Redis versions. Compatibility means communication features, and Redis command capabilities. -| Library version | Supported redis versions | -|-----------------|-------------------| -| 3.9+ | 5.0 and 6.2 Family of releases | -| >= 4.0 | Version 5.0 to current | + +| Jedis version | Supported Redis versions | JDK Compatibility | +|---------------|--------------------------------|-------------------| +| 3.9+ | 5.0 and 6.2 Family of releases | 8, 11 | +| >= 4.0 | Version 5.0 to current | 8, 11, 17 | +| >= 5.0 | Version 6.0 to current | 8, 11, 17 | ## Getting started @@ -42,7 +54,7 @@ To get started with Jedis, first add it as a dependency in your Java project. If redis.clients jedis - 4.4.3 + 5.0.0 ``` @@ -108,6 +120,13 @@ Now you can use the `JedisCluster` instance and send commands like you would wit jedis.sadd("planets", "Mars"); ``` +## Using Redis modules + +Jedis includes support for [Redis modules](https://redis.io/docs/modules/) such as +[RedisJSON](https://oss.redis.com/redisjson/) and [RediSearch](https://oss.redis.com/redisearch/). + +See the [RedisJSON Jedis](docs/redisjson.md) or [RediSearch Jedis](docs/redisearch.md) for details. + ## Failover Jedis supports retry and failover for your Redis deployments. This is useful when: @@ -126,25 +145,26 @@ You can also check the [latest Jedis Javadocs](https://www.javadoc.io/doc/redis. Some specific use-case examples can be found in [`redis.clients.jedis.examples` package](src/test/java/redis/clients/jedis/examples/) of the test source codes. -## Using Redis modules +## Troubleshooting -Jedis includes support for [Redis modules](https://redis.io/docs/modules/) such as -[RedisJSON](https://oss.redis.com/redisjson/) and [RediSearch](https://oss.redis.com/redisearch/). +If you run into trouble or have any questions, we're here to help! -See the [RedisJSON Jedis](docs/redisjson.md) or [RediSearch Jedis](docs/redisearch.md) for details. +Hit us up on the [Redis Discord Server](http://discord.gg/redis) or +[Jedis GitHub Discussions](https://github.com/redis/jedis/discussions) or +[Jedis mailing list](http://groups.google.com/group/jedis_redis). -## Troubleshooting +## Contributing -If you run into trouble or have any questions, we're here to help! +We'd love your contributions! -Hit us up on the [Redis Discord Server](http://discord.gg/redis) or [open an issue on GitHub](https://github.com/redis/jedis). +Bug reports are always welcome! [You can open a bug report on GitHub](https://github.com/redis/jedis/issues/new). -You can also find help on the [Jedis mailing list](http://groups.google.com/group/jedis_redis) or the -[GitHub Discussions](https://github.com/redis/jedis/discussions). +You can also contribute documentation -- or anything to improve Jedis. Please see +[contribution guideline](https://github.com/redis/jedis/blob/master/.github/CONTRIBUTING.md) for more details. ## License -Jedis is licensed under the [MIT license](https://github.com/redis/jedis/blob/master/LICENSE.txt). +Jedis is licensed under the [MIT license](https://github.com/redis/jedis/blob/master/LICENSE). ## Sponsorship diff --git a/docs/jedis5-breaking.md b/docs/breaking-5.md similarity index 83% rename from docs/jedis5-breaking.md rename to docs/breaking-5.md index f9d5df7ad4..4a013c3800 100644 --- a/docs/jedis5-breaking.md +++ b/docs/breaking-5.md @@ -1,5 +1,24 @@ # Jedis 5 Breaking Changes +- All variants of `blmpop` and `bzmpop` methods now take `double timeout` parameter instead of `long timeout` parameter. + This is breaking ONLY IF you are using `Long` for timeout. + +- `Reducer` abstract class is refactored: + - **`Reducer(String field)` constructor is removed; `Reducer(String name, String field)` constructor is added.** + - **`Reducer(String name)` constructor is added; it will cause runtime error with older `Reducer(String field)` constructor.** + - `getName` method is removed. + - `getAlias` method is removed. + - `setAlias` method is removed; use `as` method. + - `setAliasAsField` method is removed. + - `getOwnArgs` method is now abstract. + - `getArgs` method is removed. + +- `quit()` method has been removed from `Connection` and `ServerCommands` interface and implementations. + +- `updatePassword(String password)` method has been removed from `JedisClientConfig` and implementations. + +- `setPassword(String password)` method has been removed from both `JedisFactory` and `ConnectionFactory` classes. + - Both `bzpopmax(double timeout, String... keys)` and `bzpopmin(double timeout, String... keys)` now return `KeyValue` (instead of `KeyedZSetElement`). - Both `bzpopmax(double timeout, byte[]... keys)` and `bzpopmin(double timeout, byte[]... keys)` now return `KeyValue` (instead of `List`). @@ -40,11 +59,35 @@ - `tsMRevRange(long fromTimestamp, long toTimestamp, String... filters)` - `tsMRevRange(TSMRangeParams multiRangeParams)` +- `jsonNumIncrBy(String key, Path2 path, double value)` method now returns `Object` instead of `JSONArray`. + - The returning object would still be JSONArray for all previous cases. So simple type casting is enough to handle this change. + - The returning object will be `List` when running under RESP3 protocol. + - `getAgeSeconds()` in `AccessControlLogEntry` now returns `Double` instead of `String`. +- Both `ftConfigGet(String option)` and `ftConfigGet(String indexName, String option)` methods now return `Map` instead of `Map`. + +- `ftList()` method now returns `Set` instead of `List`. + - `graphSlowlog(String graphName)` now returns `List>` (instead of `List>`). -- All _payload_ related parameters are removed from _search_ related classes; namely `Document`, `IndexDefinition`, `Query`. +- `CommandListFilterByParams` now throws `IllegalArgumentException` (instead of `JedisDataException`) in case of unfulfilling filter. + +- `FailoverParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments. + +- `XPendingParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments. + +- `get()` option has been removed from `SetParams`. Following methods have been added in Jedis/UnifiedJedis for convenience: + - `setGet(String key, String value)` method has been added in `StringCommands` interface. + - `setGet(byte[] key, byte[] value)` method has been added in `StringBinaryCommands` interface. + +- `xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName)` method has been removed from everywhere. + - Use `xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)` instead. + +- `xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName)` method has been removed from everywhere. + - Use `xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)` instead. + +- `retentionTime(long retentionTime)` method in `TSAlterParams` has been removed. Use `retention(long)` method instead. - Following classes have been removed: - `KeyedZSetElement` @@ -59,59 +102,39 @@ - `BINARY_MAP_FROM_PAIRS` - `STRING_ORDERED_SET` +- All _payload_ related parameters are removed from _search_ related classes; namely `Document`, `IndexDefinition`, `Query`. + +- `topkCount(String key, String... items)` method has been removed from everywhere. + +- Following methods supporting JSON.RESP command have been removed: + - `jsonResp(String key)` + - `jsonResp(String key, Path path)` + - `jsonResp(String key, Path2 path)` + - `RedisJsonCommands` and `RedisJsonPipelineCommands` interfaces have been moved into `redis.clients.jedis.json.commands` package. +- `AbortedTransactionException` is removed. + - `Queable` class is removed. - `Params` abstract class is removed. - `toString()` support used by its sub-classes is now unavailable. -- `CommandListFilterByParams` now throws `IllegalArgumentException` (instead of `JedisDataException`) in case of unfulfilling filter. - -- `FailoverParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments. - -- `XPendingParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments. - - `getParams()` method is removed from `SortingParams` class. -- `addCommandEncodedArguments` and `addCommandBinaryArguments` methods have been removed from `FieldName` class. - -- `getArgs` method is removed from `AggregationBuilder` class. - -- `limit` and `getArgs` methods have been removed from `Group` class. - -- `Reducer` abstract class is refactored: - - `Reducer(String field)` constructor is removed; `Reducer(String name, String field)` constructor is added. - - `Reducer(String name)` constructor is added; it will cause runtime error with older `Reducer(String field)` constructor. - - `getName` method is removed. - - `getAlias` method is removed. - - `setAlias` method is removed; use `as` method. - - `setAliasAsField` method is removed. - - `getOwnArgs` method is now abstract. - - `getArgs` method is removed. - -- All variants of `blmpop` and `bzmpop` methods now take `double timeout` parameter instead of `long timeout` parameter. - This is breaking ONLY IF you are using `Long` for timeout. +- Both `SEARCH_AGGREGATION_RESULT` and `SEARCH_AGGREGATION_RESULT_WITH_CURSOR` implementations from `SearchBuilderFactory` class have been moved to `AggregationResult` class. - +- All `AggregationResult` constructors have been made `private`. -- `quit()` method has been removed from `Connection` and `ServerCommands` interface and implementations. +- `getArgs()`, `getArgsString()` and `serializeRedisArgs(List redisArgs)` methods have been removed from `AggregationBuilder`. -- `updatePassword(String password)` method has been removed from `JedisClientConfig` and implementations. - -- `setPassword(String password)` method has been removed from both `JedisFactory` and `ConnectionFactory` classes. - -- `get()` option has been removed from `SetParams`. Following methods have been added in Jedis/UnifiedJedis for convenience: - - `setGet(String key, String value)` method has been added in `StringCommands` interface. - - `setGet(byte[] key, byte[] value)` method has been added in `StringBinaryCommands` interface. +- `totalResults` variable in `AggregationResult` has been made private. Use `getTotalResults()` method instead. -- `xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName)` method has been removed from everywhere. - - Use `xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)` instead. +- `getArgs()` and `limit(Limit limit)` methods have been removed from `Group` class. -- `xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName)` method has been removed from everywhere. - - Use `xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)` instead. +- `addCommandEncodedArguments` and `addCommandBinaryArguments` methods have been removed from `FieldName` class. -- `topkCount(String key, String... items)` method has been removed from everywhere. +- `addObjects(int[] ints)` method has been removed from `CommandArguments`. - Following methods have been removed: - `strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params)` @@ -119,7 +142,7 @@ - `strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params)` - `strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params)` -- `StrAlgoLCSParams` has been removed. +- `StrAlgoLCSParams` class has been removed. - Following methods have been removed from all Pipeline classes: - `ftCursorRead(String indexName, long cursorId, int count)` @@ -130,14 +153,6 @@ - `ftAliasUpdate(String aliasName, String indexName)` - `ftAliasDel(String aliasName)` -- `addObjects(int[] ints)` method has been removed from `CommandArguments`. - -- `getArgsString()` and `serializeRedisArgs(List redisArgs)` methods have been removed from `AggregationBuilder`. - -- `totalResults` variable in `AggregationResult` has been made private. Use `getTotalResults()` method instead. - -- `retentionTime(long retentionTime)` method in `TSAlterParams` has been removed. Use `retention(long)` method instead. - - `JedisSentineled(String masterName, Set sentinels, JedisClientConfig masterClientConfig, JedisClientConfig sentinelClientConfig)` and `JedisSentineled(String masterName, Set sentinels, GenericObjectPoolConfig poolConfig, JedisClientConfig masterClientConfig, JedisClientConfig sentinelClientConfig)` constructors have been removed. diff --git a/docs/failover.md b/docs/failover.md index c2759b8f47..8414e41376 100644 --- a/docs/failover.md +++ b/docs/failover.md @@ -152,7 +152,7 @@ FailoverReporter reporter = new FailoverReporter(); provider.setClusterFailoverPostProcessor(reporter); ``` -The provider will call your `accept` whenver a faoliver occurs. +The provider will call your `accept` whenever a faoliver occurs. ## Failing back diff --git a/docs/jedis-maven.md b/docs/jedis-maven.md index 1c5b0f2598..6466b1ef3a 100644 --- a/docs/jedis-maven.md +++ b/docs/jedis-maven.md @@ -6,7 +6,7 @@ redis.clients jedis - 4.3.0 + 5.0.0 ``` @@ -28,7 +28,7 @@ and redis.clients jedis - 4.4.0-SNAPSHOT + 5.1.0-SNAPSHOT ``` diff --git a/pom.xml b/pom.xml index f2995791da..e2d0183a05 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ jar redis.clients jedis - 5.0.0-SNAPSHOT + 5.2.0-SNAPSHOT Jedis Jedis is a blazingly small and sane Redis java client. https://github.com/redis/jedis @@ -19,7 +19,7 @@ Jedis Mailing List jedis_redis@googlegroups.com - http://groups.google.com/group/jedis_redis + https://groups.google.com/group/jedis_redis @@ -27,14 +27,14 @@ MIT - http://github.com/redis/jedis/raw/master/LICENSE.txt + https://github.com/redis/jedis/blob/master/LICENSE repo github - http://github.com/redis/jedis/issues + https://github.com/redis/jedis/issues @@ -46,9 +46,11 @@ github - 1.7.36 redis.clients.jedis + 1.7.36 1.7.1 + 2.16.0 + 3.2.3 @@ -60,12 +62,12 @@ org.apache.commons commons-pool2 - 2.11.1 + 2.12.0 org.json json - 20230227 + 20231013 com.google.code.gson @@ -73,6 +75,22 @@ 2.10.1 + + + com.kohlschutter.junixsocket + junixsocket-core + 2.8.3 + pom + test + + + + org.locationtech.jts + jts-core + 1.19.0 + test + + junit junit @@ -91,31 +109,26 @@ ${slf4j.version} test - - com.kohlschutter.junixsocket - junixsocket-core - 2.6.1 - pom - test - org.mockito mockito-inline - 3.12.4 + 4.11.0 test com.fasterxml.jackson.core jackson-databind - 2.14.2 + ${jackson.version} test com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.14.2 + ${jackson.version} test + + io.github.resilience4j resilience4j-all @@ -158,7 +171,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.11 @@ -184,7 +197,7 @@ maven-surefire-plugin - 3.1.2 + ${maven.surefire.version} ${redis-hosts} @@ -212,7 +225,7 @@ maven-javadoc-plugin - 3.5.0 + 3.6.3 8 false @@ -313,7 +326,7 @@ maven-surefire-plugin - 3.1.2 + ${maven.surefire.version} **/examples/*Example.java diff --git a/src/main/java/redis/clients/jedis/AbstractPipeline.java b/src/main/java/redis/clients/jedis/AbstractPipeline.java new file mode 100644 index 0000000000..f4eb0335dc --- /dev/null +++ b/src/main/java/redis/clients/jedis/AbstractPipeline.java @@ -0,0 +1,26 @@ +package redis.clients.jedis; + +import java.io.Closeable; + +public abstract class AbstractPipeline extends PipeliningBase implements Closeable { + + protected AbstractPipeline(CommandObjects commandObjects) { + super(commandObjects); + } + + @Override + public abstract void close(); + + /** + * Synchronize pipeline by reading all responses. + */ + public abstract void sync(); + + public Response publish(String channel, String message) { + return appendCommand(commandObjects.publish(channel, message)); + } + + public Response publish(byte[] channel, byte[] message) { + return appendCommand(commandObjects.publish(channel, message)); + } +} diff --git a/src/main/java/redis/clients/jedis/AbstractTransaction.java b/src/main/java/redis/clients/jedis/AbstractTransaction.java new file mode 100644 index 0000000000..ed6f397caa --- /dev/null +++ b/src/main/java/redis/clients/jedis/AbstractTransaction.java @@ -0,0 +1,35 @@ +package redis.clients.jedis; + +import java.io.Closeable; +import java.util.List; + +public abstract class AbstractTransaction extends PipeliningBase implements Closeable { + + protected AbstractTransaction() { + super(new CommandObjects()); + } + + public abstract void multi(); + + /** + * Must be called before {@link AbstractTransaction#multi() MULTI}. + */ + public abstract String watch(final String... keys); + + /** + * Must be called before {@link AbstractTransaction#multi() MULTI}. + */ + public abstract String watch(final byte[]... keys); + + public abstract String unwatch(); + + @Override public abstract void close(); + + public abstract List exec(); + + public abstract String discard(); + + public Response waitReplicas(int replicas, long timeout) { + return appendCommand(commandObjects.waitReplicas(replicas, timeout)); + } +} diff --git a/src/main/java/redis/clients/jedis/BuilderFactory.java b/src/main/java/redis/clients/jedis/BuilderFactory.java index 46ce255c35..c7349f3e89 100644 --- a/src/main/java/redis/clients/jedis/BuilderFactory.java +++ b/src/main/java/redis/clients/jedis/BuilderFactory.java @@ -290,52 +290,57 @@ public String toString() { } }; - public static final Builder> ENCODED_OBJECT_MAP = new Builder>() { + public static final Builder> BINARY_MAP = new Builder>() { @Override - public Map build(Object data) { - if (data == null) return null; + @SuppressWarnings("unchecked") + public Map build(Object data) { final List list = (List) data; if (list.isEmpty()) return Collections.emptyMap(); if (list.get(0) instanceof KeyValue) { - final Map map = new HashMap<>(list.size(), 1f); + final Map map = new JedisByteHashMap(); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { KeyValue kv = (KeyValue) iterator.next(); - map.put(STRING.build(kv.getKey()), ENCODED_OBJECT.build(kv.getValue())); + map.put(BINARY.build(kv.getKey()), BINARY.build(kv.getValue())); } return map; } else { - final Map map = new HashMap<>(list.size() / 2, 1f); + final Map map = new JedisByteHashMap(); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { - map.put(STRING.build(iterator.next()), ENCODED_OBJECT.build(iterator.next())); + map.put(BINARY.build(iterator.next()), BINARY.build(iterator.next())); } return map; } } + + @Override + public String toString() { + return "Map"; + } }; - public static final Builder> BINARY_MAP = new Builder>() { + public static final Builder> STRING_MAP = new Builder>() { @Override @SuppressWarnings("unchecked") - public Map build(Object data) { + public Map build(Object data) { final List list = (List) data; if (list.isEmpty()) return Collections.emptyMap(); if (list.get(0) instanceof KeyValue) { - final Map map = new JedisByteHashMap(); + final Map map = new HashMap<>(list.size(), 1f); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { KeyValue kv = (KeyValue) iterator.next(); - map.put(BINARY.build(kv.getKey()), BINARY.build(kv.getValue())); + map.put(STRING.build(kv.getKey()), STRING.build(kv.getValue())); } return map; } else { - final Map map = new JedisByteHashMap(); + final Map map = new HashMap<>(list.size() / 2, 1f); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { - map.put(BINARY.build(iterator.next()), BINARY.build(iterator.next())); + map.put(STRING.build(iterator.next()), STRING.build(iterator.next())); } return map; } @@ -343,38 +348,64 @@ public Map build(Object data) { @Override public String toString() { - return "Map"; + return "Map"; } }; - public static final Builder> STRING_MAP = new Builder>() { + public static final Builder> ENCODED_OBJECT_MAP = new Builder>() { @Override - @SuppressWarnings("unchecked") - public Map build(Object data) { + public Map build(Object data) { + if (data == null) return null; final List list = (List) data; if (list.isEmpty()) return Collections.emptyMap(); if (list.get(0) instanceof KeyValue) { - final Map map = new HashMap<>(list.size(), 1f); + final Map map = new HashMap<>(list.size(), 1f); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { KeyValue kv = (KeyValue) iterator.next(); - map.put(STRING.build(kv.getKey()), STRING.build(kv.getValue())); + map.put(STRING.build(kv.getKey()), ENCODED_OBJECT.build(kv.getValue())); } return map; } else { - final Map map = new HashMap<>(list.size() / 2, 1f); + final Map map = new HashMap<>(list.size() / 2, 1f); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { - map.put(STRING.build(iterator.next()), STRING.build(iterator.next())); + map.put(STRING.build(iterator.next()), ENCODED_OBJECT.build(iterator.next())); } return map; } } + }; + public static final Builder AGGRESSIVE_ENCODED_OBJECT = new Builder() { @Override - public String toString() { - return "Map"; + public Object build(Object data) { + if (data == null) return null; + + if (data instanceof List) { + final List list = (List) data; + if (list.isEmpty()) return Collections.emptyMap(); + + if (list.get(0) instanceof KeyValue) { + return ((List) data).stream() + .filter(kv -> kv != null && kv.getKey() != null && kv.getValue() != null) + .collect(Collectors.toMap(kv -> STRING.build(kv.getKey()), + kv -> this.build(kv.getValue()))); + } else { + return list.stream().map(this::build).collect(Collectors.toList()); + } + } else if (data instanceof byte[]) { + return STRING.build(data); + } + return data; + } + }; + + public static final Builder> AGGRESSIVE_ENCODED_OBJECT_MAP = new Builder>() { + @Override + public Map build(Object data) { + return (Map) AGGRESSIVE_ENCODED_OBJECT.build(data); } }; @@ -415,6 +446,37 @@ public String toString() { } }; + public static final Builder> STRING_LONG_MAP = new Builder>() { + @Override + @SuppressWarnings("unchecked") + public Map build(Object data) { + final List list = (List) data; + if (list.isEmpty()) return Collections.emptyMap(); + + if (list.get(0) instanceof KeyValue) { + final Map map = new LinkedHashMap<>(list.size(), 1f); + final Iterator iterator = list.iterator(); + while (iterator.hasNext()) { + KeyValue kv = (KeyValue) iterator.next(); + map.put(STRING.build(kv.getKey()), LONG.build(kv.getValue())); + } + return map; + } else { + final Map map = new LinkedHashMap<>(list.size() / 2, 1f); + final Iterator iterator = list.iterator(); + while (iterator.hasNext()) { + map.put(STRING.build(iterator.next()), LONG.build(iterator.next())); + } + return map; + } + } + + @Override + public String toString() { + return "Map"; + } + }; + public static final Builder> KEYED_ELEMENT = new Builder>() { @Override @SuppressWarnings("unchecked") @@ -935,6 +997,108 @@ public Map build(Object data) { } }; + private static final Builder>> CLUSTER_SHARD_SLOTS_RANGES = new Builder>>() { + + @Override + public List> build(Object data) { + if (null == data) { + return null; + } + + List rawSlots = (List) data; + List> slotsRanges = new ArrayList<>(); + for (int i = 0; i < rawSlots.size(); i += 2) { + slotsRanges.add(Arrays.asList(rawSlots.get(i), rawSlots.get(i + 1))); + } + return slotsRanges; + } + }; + + private static final Builder> CLUSTER_SHARD_NODE_INFO_LIST + = new Builder>() { + + final Map mappingFunctions = createDecoderMap(); + + private Map createDecoderMap() { + + Map tempMappingFunctions = new HashMap<>(); + tempMappingFunctions.put(ClusterShardNodeInfo.ID, STRING); + tempMappingFunctions.put(ClusterShardNodeInfo.ENDPOINT, STRING); + tempMappingFunctions.put(ClusterShardNodeInfo.IP, STRING); + tempMappingFunctions.put(ClusterShardNodeInfo.HOSTNAME, STRING); + tempMappingFunctions.put(ClusterShardNodeInfo.PORT, LONG); + tempMappingFunctions.put(ClusterShardNodeInfo.TLS_PORT, LONG); + tempMappingFunctions.put(ClusterShardNodeInfo.ROLE, STRING); + tempMappingFunctions.put(ClusterShardNodeInfo.REPLICATION_OFFSET, LONG); + tempMappingFunctions.put(ClusterShardNodeInfo.HEALTH, STRING); + + return tempMappingFunctions; + } + + @Override + @SuppressWarnings("unchecked") + public List build(Object data) { + if (null == data) { + return null; + } + + List response = new ArrayList<>(); + + List clusterShardNodeInfos = (List) data; + for (Object clusterShardNodeInfoObject : clusterShardNodeInfos) { + List clusterShardNodeInfo = (List) clusterShardNodeInfoObject; + Iterator iterator = clusterShardNodeInfo.iterator(); + response.add(new ClusterShardNodeInfo(createMapFromDecodingFunctions(iterator, mappingFunctions))); + } + + return response; + } + + @Override + public String toString() { + return "List"; + } + }; + + public static final Builder> CLUSTER_SHARD_INFO_LIST + = new Builder>() { + + final Map mappingFunctions = createDecoderMap(); + + private Map createDecoderMap() { + + Map tempMappingFunctions = new HashMap<>(); + tempMappingFunctions.put(ClusterShardInfo.SLOTS, CLUSTER_SHARD_SLOTS_RANGES); + tempMappingFunctions.put(ClusterShardInfo.NODES, CLUSTER_SHARD_NODE_INFO_LIST); + + return tempMappingFunctions; + } + + @Override + @SuppressWarnings("unchecked") + public List build(Object data) { + if (null == data) { + return null; + } + + List response = new ArrayList<>(); + + List clusterShardInfos = (List) data; + for (Object clusterShardInfoObject : clusterShardInfos) { + List clusterShardInfo = (List) clusterShardInfoObject; + Iterator iterator = clusterShardInfo.iterator(); + response.add(new ClusterShardInfo(createMapFromDecodingFunctions(iterator, mappingFunctions))); + } + + return response; + } + + @Override + public String toString() { + return "List"; + } + }; + public static final Builder> MODULE_LIST = new Builder>() { @Override public List build(Object data) { @@ -1705,7 +1869,15 @@ private void addMatchedPosition(List matchedPositions, Object o @Override @SuppressWarnings("unchecked") public Map build(Object data) { - final List list = (List) data; + final List list = (List) data; + if (list.isEmpty()) return Collections.emptyMap(); + + if (list.get(0) instanceof KeyValue) { + return ((List) list).stream() + .collect(Collectors.toMap(kv -> STRING.build(kv.getKey()), + kv -> STRING.build(kv.getValue()))); + } + final Map map = new HashMap<>(list.size()); for (Object object : list) { if (object == null) continue; @@ -1722,14 +1894,41 @@ public String toString() { } }; - public static final Builder> LIBRARY_LIST = new Builder>() { + public static final Builder> ENCODED_OBJECT_MAP_FROM_PAIRS = new Builder>() { @Override - public List build(Object data) { - List list = (List) data; - return list.stream().map(o -> LibraryInfo.LIBRARY_BUILDER.build(o)).collect(Collectors.toList()); + @SuppressWarnings("unchecked") + public Map build(Object data) { + final List list = (List) data; + if (list.isEmpty()) return Collections.emptyMap(); + + if (list.get(0) instanceof KeyValue) { + return ((List) list).stream() + .collect(Collectors.toMap(kv -> STRING.build(kv.getKey()), + kv -> ENCODED_OBJECT.build(kv.getValue()))); + } + + final Map map = new HashMap<>(list.size()); + for (Object object : list) { + if (object == null) continue; + final List flat = (List) object; + if (flat.isEmpty()) continue; + map.put(STRING.build(flat.get(0)), STRING.build(flat.get(1))); + } + return map; + } + + @Override + public String toString() { + return "Map"; } }; + /** + * @deprecated Use {@link LibraryInfo#LIBRARY_INFO_LIST}. + */ + @Deprecated + public static final Builder> LIBRARY_LIST = LibraryInfo.LIBRARY_INFO_LIST; + public static final Builder>> STRING_LIST_LIST = new Builder>>() { @Override @SuppressWarnings("unchecked") diff --git a/src/main/java/redis/clients/jedis/ClientSetInfoConfig.java b/src/main/java/redis/clients/jedis/ClientSetInfoConfig.java new file mode 100644 index 0000000000..c1d804b28a --- /dev/null +++ b/src/main/java/redis/clients/jedis/ClientSetInfoConfig.java @@ -0,0 +1,70 @@ +package redis.clients.jedis; + +import java.util.Arrays; +import java.util.HashSet; +import redis.clients.jedis.exceptions.JedisValidationException; + +public final class ClientSetInfoConfig { + + private final boolean disabled; + + private final String libNameSuffix; + + public ClientSetInfoConfig() { + this(false, null); + } + + public ClientSetInfoConfig(boolean disabled) { + this(disabled, null); + } + + /** + * @param libNameSuffix must not have braces ({@code ()[]{}}) and spaces will be replaced with hyphens + */ + public ClientSetInfoConfig(String libNameSuffix) { + this(false, libNameSuffix); + } + + private ClientSetInfoConfig(boolean disabled, String libNameSuffix) { + this.disabled = disabled; + this.libNameSuffix = validateLibNameSuffix(libNameSuffix); + } + + private static final HashSet BRACES = new HashSet<>(Arrays.asList('(', ')', '[', ']', '{', '}')); + + private static String validateLibNameSuffix(String suffix) { + if (suffix == null || suffix.trim().isEmpty()) { + return null; + } + + for (int i = 0; i < suffix.length(); i++) { + char c = suffix.charAt(i); + if (c < ' ' || c > '~' || BRACES.contains(c)) { + throw new JedisValidationException("lib-name suffix cannot contain braces, newlines or " + + "special characters."); + } + } + + return suffix.replaceAll("\\s", "-"); + } + + public final boolean isDisabled() { + return disabled; + } + + public final String getLibNameSuffix() { + return libNameSuffix; + } + + public static final ClientSetInfoConfig DEFAULT = new ClientSetInfoConfig(); + + public static final ClientSetInfoConfig DISABLED = new ClientSetInfoConfig(true); + + /** + * @param suffix must not have braces ({@code ()[]{}}) and spaces will be replaced with hyphens + * @return config + */ + public static ClientSetInfoConfig withLibNameSuffix(String suffix) { + return new ClientSetInfoConfig(suffix); + } +} diff --git a/src/main/java/redis/clients/jedis/ClusterPipeline.java b/src/main/java/redis/clients/jedis/ClusterPipeline.java index e70db767f9..0c850c8ed8 100644 --- a/src/main/java/redis/clients/jedis/ClusterPipeline.java +++ b/src/main/java/redis/clients/jedis/ClusterPipeline.java @@ -1,5 +1,6 @@ package redis.clients.jedis; +import java.time.Duration; import java.util.Set; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import redis.clients.jedis.providers.ClusterConnectionProvider; @@ -23,6 +24,13 @@ public ClusterPipeline(Set clusterNodes, JedisClientConfig clientCo this.closeable = this.provider; } + public ClusterPipeline(Set clusterNodes, JedisClientConfig clientConfig, + GenericObjectPoolConfig poolConfig, Duration topologyRefreshPeriod) { + this(new ClusterConnectionProvider(clusterNodes, clientConfig, poolConfig, topologyRefreshPeriod), + createClusterCommandObjects(clientConfig.getRedisProtocol())); + this.closeable = this.provider; + } + public ClusterPipeline(ClusterConnectionProvider provider) { this(provider, new ClusterCommandObjects()); } diff --git a/src/main/java/redis/clients/jedis/CommandArguments.java b/src/main/java/redis/clients/jedis/CommandArguments.java index 77793fc378..b9190245ce 100644 --- a/src/main/java/redis/clients/jedis/CommandArguments.java +++ b/src/main/java/redis/clients/jedis/CommandArguments.java @@ -3,10 +3,12 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; + import redis.clients.jedis.args.Rawable; import redis.clients.jedis.args.RawableFactory; import redis.clients.jedis.commands.ProtocolCommand; import redis.clients.jedis.params.IParams; +import redis.clients.jedis.search.RediSearchUtil; public class CommandArguments implements Iterable { @@ -34,10 +36,19 @@ public CommandArguments add(Object arg) { args.add((Rawable) arg); } else if (arg instanceof byte[]) { args.add(RawableFactory.from((byte[]) arg)); + } else if (arg instanceof Integer) { + args.add(RawableFactory.from((Integer) arg)); + } else if (arg instanceof Double) { + args.add(RawableFactory.from((Double) arg)); + } else if (arg instanceof Boolean) { + args.add(RawableFactory.from((Boolean) arg ? 1 : 0)); + } else if (arg instanceof float[]) { + args.add(RawableFactory.from(RediSearchUtil.toByteArray((float[]) arg))); } else if (arg instanceof String) { args.add(RawableFactory.from((String) arg)); - } else if (arg instanceof Boolean) { - args.add(RawableFactory.from(Integer.toString((Boolean) arg ? 1 : 0))); + } else if (arg instanceof GeoCoordinate) { + GeoCoordinate geo = (GeoCoordinate) arg; + args.add(RawableFactory.from(geo.getLongitude() + "," + geo.getLatitude())); } else { args.add(RawableFactory.from(String.valueOf(arg))); } @@ -82,6 +93,11 @@ public final CommandArguments keys(Object... keys) { return this; } + public final CommandArguments keys(Collection keys) { + keys.forEach(key -> key(key)); + return this; + } + public final CommandArguments addParams(IParams params) { params.addParams(this); return this; diff --git a/src/main/java/redis/clients/jedis/CommandObjects.java b/src/main/java/redis/clients/jedis/CommandObjects.java index d3d77db3b4..da773d5782 100644 --- a/src/main/java/redis/clients/jedis/CommandObjects.java +++ b/src/main/java/redis/clients/jedis/CommandObjects.java @@ -5,6 +5,7 @@ import java.util.*; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; import java.util.stream.Collectors; import org.json.JSONArray; import org.json.JSONObject; @@ -15,6 +16,9 @@ import redis.clients.jedis.bloom.*; import redis.clients.jedis.bloom.RedisBloomProtocol.*; import redis.clients.jedis.commands.ProtocolCommand; +import redis.clients.jedis.gears.*; +import redis.clients.jedis.gears.RedisGearsProtocol.*; +import redis.clients.jedis.gears.resps.GearsLibraryInfo; import redis.clients.jedis.graph.GraphProtocol.*; import redis.clients.jedis.json.*; import redis.clients.jedis.json.JsonProtocol.JsonCommand; @@ -34,10 +38,16 @@ public class CommandObjects { - private RedisProtocol proto; + private RedisProtocol protocol; - protected void setProtocol(RedisProtocol proto) { - this.proto = proto; + // TODO: restrict? + public final void setProtocol(RedisProtocol proto) { + this.protocol = proto; + } + + // TODO: remove? + protected RedisProtocol getProtocol() { + return protocol; } private volatile JsonObjectMapper jsonObjectMapper; @@ -1094,7 +1104,7 @@ public final CommandObject> hrandfield(String key, long count) { public final CommandObject>> hrandfieldWithValues(String key, long count) { return new CommandObject<>(commandArguments(HRANDFIELD).key(key).add(count).add(WITHVALUES), - proto != RedisProtocol.RESP3 ? BuilderFactory.STRING_PAIR_LIST : BuilderFactory.STRING_PAIR_LIST_FROM_PAIRS); + protocol != RedisProtocol.RESP3 ? BuilderFactory.STRING_PAIR_LIST : BuilderFactory.STRING_PAIR_LIST_FROM_PAIRS); } public final CommandObject> hgetAll(byte[] key) { @@ -1111,7 +1121,7 @@ public final CommandObject> hrandfield(byte[] key, long count) { public final CommandObject>> hrandfieldWithValues(byte[] key, long count) { return new CommandObject<>(commandArguments(HRANDFIELD).key(key).add(count).add(WITHVALUES), - proto != RedisProtocol.RESP3 ? BuilderFactory.BINARY_PAIR_LIST : BuilderFactory.BINARY_PAIR_LIST_FROM_PAIRS); + protocol != RedisProtocol.RESP3 ? BuilderFactory.BINARY_PAIR_LIST : BuilderFactory.BINARY_PAIR_LIST_FROM_PAIRS); } public final CommandObject>> hscan(String key, String cursor, ScanParams params) { @@ -1992,11 +2002,11 @@ public final CommandObject>> bzmpop(double timeout, } private Builder> getTupleListBuilder() { - return proto == RedisProtocol.RESP3 ? BuilderFactory.TUPLE_LIST_RESP3 : BuilderFactory.TUPLE_LIST; + return protocol == RedisProtocol.RESP3 ? BuilderFactory.TUPLE_LIST_RESP3 : BuilderFactory.TUPLE_LIST; } private Builder> getTupleSetBuilder() { - return proto == RedisProtocol.RESP3 ? BuilderFactory.TUPLE_ZSET_RESP3 : BuilderFactory.TUPLE_ZSET; + return protocol == RedisProtocol.RESP3 ? BuilderFactory.TUPLE_ZSET_RESP3 : BuilderFactory.TUPLE_ZSET; } // Sorted Set commands @@ -2394,24 +2404,24 @@ public final CommandObject> xrevrange(String key, String end, return new CommandObject<>(commandArguments(XREVRANGE).key(key).add(end).add(start).add(COUNT).add(count), BuilderFactory.STREAM_ENTRY_LIST); } - public final CommandObject> xrange(byte[] key, byte[] start, byte[] end) { + public final CommandObject> xrange(byte[] key, byte[] start, byte[] end) { return new CommandObject<>(commandArguments(XRANGE).key(key).add(start == null ? "-" : start).add(end == null ? "+" : end), - BuilderFactory.BINARY_LIST); + BuilderFactory.RAW_OBJECT_LIST); } - public final CommandObject> xrange(byte[] key, byte[] start, byte[] end, int count) { + public final CommandObject> xrange(byte[] key, byte[] start, byte[] end, int count) { return new CommandObject<>(commandArguments(XRANGE).key(key).add(start == null ? "-" : start).add(end == null ? "+" : end) - .add(COUNT).add(count), BuilderFactory.BINARY_LIST); + .add(COUNT).add(count), BuilderFactory.RAW_OBJECT_LIST); } - public final CommandObject> xrevrange(byte[] key, byte[] end, byte[] start) { + public final CommandObject> xrevrange(byte[] key, byte[] end, byte[] start) { return new CommandObject<>(commandArguments(XREVRANGE).key(key).add(end == null ? "+" : end).add(start == null ? "-" : start), - BuilderFactory.BINARY_LIST); + BuilderFactory.RAW_OBJECT_LIST); } - public final CommandObject> xrevrange(byte[] key, byte[] end, byte[] start, int count) { + public final CommandObject> xrevrange(byte[] key, byte[] end, byte[] start, int count) { return new CommandObject<>(commandArguments(XREVRANGE).key(key).add(end == null ? "+" : end).add(start == null ? "-" : start) - .add(COUNT).add(count), BuilderFactory.BINARY_LIST); + .add(COUNT).add(count), BuilderFactory.RAW_OBJECT_LIST); } public final CommandObject xack(String key, String group, StreamEntryID... ids) { @@ -2652,7 +2662,7 @@ public final CommandObject>>> xreadGrou return new CommandObject<>(args, BuilderFactory.STREAM_READ_RESPONSE); } - public final CommandObject> xread(XReadParams xReadParams, Map.Entry... streams) { + public final CommandObject> xread(XReadParams xReadParams, Map.Entry... streams) { CommandArguments args = commandArguments(XREAD).addParams(xReadParams).add(STREAMS); for (Map.Entry entry : streams) { args.key(entry.getKey()); @@ -2660,10 +2670,10 @@ public final CommandObject> xread(XReadParams xReadParams, Map.Entr for (Map.Entry entry : streams) { args.add(entry.getValue()); } - return new CommandObject<>(args, BuilderFactory.BINARY_LIST); + return new CommandObject<>(args, BuilderFactory.RAW_OBJECT_LIST); } - public final CommandObject> xreadGroup(byte[] groupName, byte[] consumer, + public final CommandObject> xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Map.Entry... streams) { CommandArguments args = commandArguments(XREADGROUP) .add(GROUP).add(groupName).add(consumer) @@ -2674,39 +2684,33 @@ public final CommandObject> xreadGroup(byte[] groupName, byte[] con for (Map.Entry entry : streams) { args.add(entry.getValue()); } - return new CommandObject<>(args, BuilderFactory.BINARY_LIST); + return new CommandObject<>(args, BuilderFactory.RAW_OBJECT_LIST); } // Stream commands // Scripting commands public final CommandObject eval(String script) { - return new CommandObject<>(commandArguments(EVAL).add(script).add(0), BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVAL).add(script).add(0), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject eval(String script, String sampleKey) { - return new CommandObject<>(commandArguments(EVAL).add(script).add(0).processKey(sampleKey), BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVAL).add(script).add(0).processKey(sampleKey), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject eval(String script, int keyCount, String... params) { return new CommandObject<>(commandArguments(EVAL).add(script).add(keyCount) .addObjects((Object[]) params).processKeys(Arrays.copyOf(params, keyCount)), - BuilderFactory.ENCODED_OBJECT); + BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject eval(String script, List keys, List args) { - String[] keysArray = keys.toArray(new String[keys.size()]); - String[] argsArray = args.toArray(new String[args.size()]); - return new CommandObject<>(commandArguments(EVAL).add(script).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVAL).add(script).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject evalReadonly(String script, List keys, List args) { - String[] keysArray = keys.toArray(new String[keys.size()]); - String[] argsArray = args.toArray(new String[args.size()]); - return new CommandObject<>(commandArguments(EVAL_RO).add(script).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVAL_RO).add(script).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject eval(byte[] script) { @@ -2724,49 +2728,37 @@ public final CommandObject eval(byte[] script, int keyCount, byte[]... p } public final CommandObject eval(byte[] script, List keys, List args) { - byte[][] keysArray = keys.toArray(new byte[keys.size()][]); - byte[][] argsArray = args.toArray(new byte[args.size()][]); - return new CommandObject<>(commandArguments(EVAL).add(script).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.RAW_OBJECT); + return new CommandObject<>(commandArguments(EVAL).add(script).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.RAW_OBJECT); } public final CommandObject evalReadonly(byte[] script, List keys, List args) { - byte[][] keysArray = keys.toArray(new byte[keys.size()][]); - byte[][] argsArray = args.toArray(new byte[args.size()][]); - return new CommandObject<>(commandArguments(EVAL_RO).add(script).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.RAW_OBJECT); + return new CommandObject<>(commandArguments(EVAL_RO).add(script).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.RAW_OBJECT); } public final CommandObject evalsha(String sha1) { - return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(0), BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(0), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject evalsha(String sha1, String sampleKey) { - return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(0).processKey(sampleKey), BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(0).processKey(sampleKey), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject evalsha(String sha1, int keyCount, String... params) { return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(keyCount) .addObjects((Object[]) params).processKeys(Arrays.copyOf(params, keyCount)), - BuilderFactory.ENCODED_OBJECT); + BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject evalsha(String sha1, List keys, List args) { - String[] keysArray = keys.toArray(new String[keys.size()]); - String[] argsArray = args.toArray(new String[args.size()]); - return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject evalshaReadonly(String sha1, List keys, List args) { - String[] keysArray = keys.toArray(new String[keys.size()]); - String[] argsArray = args.toArray(new String[args.size()]); - return new CommandObject<>(commandArguments(EVALSHA_RO).add(sha1).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(EVALSHA_RO).add(sha1).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject evalsha(byte[] sha1) { @@ -2784,19 +2776,13 @@ public final CommandObject evalsha(byte[] sha1, int keyCount, byte[]... } public final CommandObject evalsha(byte[] sha1, List keys, List args) { - byte[][] keysArray = keys.toArray(new byte[keys.size()][]); - byte[][] argsArray = args.toArray(new byte[args.size()][]); - return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.RAW_OBJECT); + return new CommandObject<>(commandArguments(EVALSHA).add(sha1).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.RAW_OBJECT); } public final CommandObject evalshaReadonly(byte[] sha1, List keys, List args) { - byte[][] keysArray = keys.toArray(new byte[keys.size()][]); - byte[][] argsArray = args.toArray(new byte[args.size()][]); - return new CommandObject<>(commandArguments(EVALSHA_RO).add(sha1).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.RAW_OBJECT); + return new CommandObject<>(commandArguments(EVALSHA_RO).add(sha1).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.RAW_OBJECT); } public final CommandObject> scriptExists(List sha1s) { @@ -2861,26 +2847,21 @@ public final CommandObject scriptKill(byte[] sampleKey) { return new CommandObject<>(commandArguments(SCRIPT).add(KILL).processKey(sampleKey), BuilderFactory.STRING); } - private final CommandObject SLOWLOG_RESET_COMMAND_OBJECT = new CommandObject<>(commandArguments(SLOWLOG).add(RESET), BuilderFactory.STRING); + private final CommandObject SLOWLOG_RESET_COMMAND_OBJECT + = new CommandObject<>(commandArguments(SLOWLOG).add(Keyword.RESET), BuilderFactory.STRING); public final CommandObject slowlogReset() { return SLOWLOG_RESET_COMMAND_OBJECT; } public final CommandObject fcall(String name, List keys, List args) { - String[] keysArray = keys.toArray(new String[keys.size()]); - String[] argsArray = args.toArray(new String[args.size()]); - return new CommandObject<>(commandArguments(FCALL).add(name).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(FCALL).add(name).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject fcallReadonly(String name, List keys, List args) { - String[] keysArray = keys.toArray(new String[keys.size()]); - String[] argsArray = args.toArray(new String[args.size()]); - return new CommandObject<>(commandArguments(FCALL_RO).add(name).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.ENCODED_OBJECT); + return new CommandObject<>(commandArguments(FCALL_RO).add(name).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } public final CommandObject functionDelete(String libraryName) { @@ -2888,21 +2869,21 @@ public final CommandObject functionDelete(String libraryName) { } public final CommandObject> functionList() { - return new CommandObject<>(commandArguments(FUNCTION).add(LIST), BuilderFactory.LIBRARY_LIST); + return new CommandObject<>(commandArguments(FUNCTION).add(LIST), LibraryInfo.LIBRARY_INFO_LIST); } public final CommandObject> functionList(String libraryNamePattern) { return new CommandObject<>(commandArguments(FUNCTION).add(LIST).add(LIBRARYNAME) - .add(libraryNamePattern), BuilderFactory.LIBRARY_LIST); + .add(libraryNamePattern), LibraryInfo.LIBRARY_INFO_LIST); } public final CommandObject> functionListWithCode() { - return new CommandObject<>(commandArguments(FUNCTION).add(LIST).add(WITHCODE), BuilderFactory.LIBRARY_LIST); + return new CommandObject<>(commandArguments(FUNCTION).add(LIST).add(WITHCODE), LibraryInfo.LIBRARY_INFO_LIST); } public final CommandObject> functionListWithCode(String libraryNamePattern) { return new CommandObject<>(commandArguments(FUNCTION).add(LIST).add(LIBRARYNAME) - .add(libraryNamePattern).add(WITHCODE), BuilderFactory.LIBRARY_LIST); + .add(libraryNamePattern).add(WITHCODE), LibraryInfo.LIBRARY_INFO_LIST); } public final CommandObject functionLoad(String functionCode) { @@ -2934,19 +2915,13 @@ public final CommandObject functionKill() { } public final CommandObject fcall(byte[] name, List keys, List args) { - byte[][] keysArray = keys.toArray(new byte[keys.size()][]); - byte[][] argsArray = args.toArray(new byte[args.size()][]); - return new CommandObject<>(commandArguments(FCALL).add(name).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.RAW_OBJECT); + return new CommandObject<>(commandArguments(FCALL).add(name).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.RAW_OBJECT); } public final CommandObject fcallReadonly(byte[] name, List keys, List args) { - byte[][] keysArray = keys.toArray(new byte[keys.size()][]); - byte[][] argsArray = args.toArray(new byte[args.size()][]); - return new CommandObject<>(commandArguments(FCALL_RO).add(name).add(keysArray.length) - .keys((Object[]) keysArray).addObjects((Object[]) argsArray), - BuilderFactory.RAW_OBJECT); + return new CommandObject<>(commandArguments(FCALL_RO).add(name).add(keys.size()) + .keys(keys).addObjects(args), BuilderFactory.RAW_OBJECT); } public final CommandObject functionDelete(byte[] libraryName) { @@ -3137,6 +3112,14 @@ public final CommandObject spublish(byte[] channel, byte[] message) { // Miscellaneous commands // RediSearch commands + public final CommandObject hsetObject(String key, String field, Object value) { + return new CommandObject<>(commandArguments(HSET).key(key).add(field).add(value), BuilderFactory.LONG); + } + + public final CommandObject hsetObject(String key, Map hash) { + return new CommandObject<>(addFlatMapArgs(commandArguments(HSET).key(key), hash), BuilderFactory.LONG); + } + private boolean isRoundRobinSearchCommand() { if (broadcastAndRoundRobinConfig == null) { return true; @@ -3146,8 +3129,24 @@ private boolean isRoundRobinSearchCommand() { return true; } - private CommandArguments checkAndRoundRobinSearchCommand(CommandArguments commandArguments, String indexName) { - return isRoundRobinSearchCommand() ? commandArguments.add(indexName) : commandArguments.key(indexName); + private CommandArguments checkAndRoundRobinSearchCommand(SearchCommand sc, String idx) { + CommandArguments ca = commandArguments(sc); + if (isRoundRobinSearchCommand()) { + ca.add(idx); + } else { + ca.key(idx); + } + return ca; + } + + private CommandArguments checkAndRoundRobinSearchCommand(SearchCommand sc, String idx1, String idx2) { + CommandArguments ca = commandArguments(sc); + if (isRoundRobinSearchCommand()) { + ca.add(idx1).add(idx2); + } else { + ca.key(idx1).key(idx2); + } + return ca; } private CommandArguments checkAndRoundRobinSearchCommand(CommandArguments commandArguments, byte[] indexName) { @@ -3160,7 +3159,7 @@ private CommandObject directSearchCommand(CommandObject object, String } public final CommandObject ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { - CommandArguments args = commandArguments(SearchCommand.CREATE).add(indexName) + CommandArguments args = checkAndRoundRobinSearchCommand(SearchCommand.CREATE, indexName) .addParams(indexOptions).add(SearchKeyword.SCHEMA); schema.fields.forEach(field -> args.addParams(field)); return new CommandObject<>(args, BuilderFactory.STRING); @@ -3168,116 +3167,138 @@ public final CommandObject ftCreate(String indexName, IndexOptions index public final CommandObject ftCreate(String indexName, FTCreateParams createParams, Iterable schemaFields) { - CommandArguments args = commandArguments(SearchCommand.CREATE).add(indexName) + CommandArguments args = checkAndRoundRobinSearchCommand(SearchCommand.CREATE, indexName) .addParams(createParams).add(SearchKeyword.SCHEMA); schemaFields.forEach(field -> args.addParams(field)); return new CommandObject<>(args, BuilderFactory.STRING); } public final CommandObject ftAlter(String indexName, Schema schema) { - CommandArguments args = commandArguments(SearchCommand.ALTER).add(indexName) + CommandArguments args = checkAndRoundRobinSearchCommand(SearchCommand.ALTER, indexName) .add(SearchKeyword.SCHEMA).add(SearchKeyword.ADD); schema.fields.forEach(field -> args.addParams(field)); return new CommandObject<>(args, BuilderFactory.STRING); } public final CommandObject ftAlter(String indexName, Iterable schemaFields) { - CommandArguments args = commandArguments(SearchCommand.ALTER).add(indexName) + CommandArguments args = checkAndRoundRobinSearchCommand(SearchCommand.ALTER, indexName) .add(SearchKeyword.SCHEMA).add(SearchKeyword.ADD); schemaFields.forEach(field -> args.addParams(field)); return new CommandObject<>(args, BuilderFactory.STRING); } + public final CommandObject ftAliasAdd(String aliasName, String indexName) { + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.ALIASADD, aliasName, indexName), BuilderFactory.STRING); + } + + public final CommandObject ftAliasUpdate(String aliasName, String indexName) { + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.ALIASUPDATE, aliasName, indexName), BuilderFactory.STRING); + } + + public final CommandObject ftAliasDel(String aliasName) { + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.ALIASDEL, aliasName), BuilderFactory.STRING); + } + + public final CommandObject ftDropIndex(String indexName) { + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.DROPINDEX, indexName), BuilderFactory.STRING); + } + + public final CommandObject ftDropIndexDD(String indexName) { + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.DROPINDEX, indexName).add(SearchKeyword.DD), + BuilderFactory.STRING); + } + public final CommandObject ftSearch(String indexName, String query) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).add(query), - new SearchResultBuilder(true, false, true)); + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.SEARCH, indexName).add(query), + getSearchResultBuilder(() -> new SearchResultBuilder(true, false, true))); } public final CommandObject ftSearch(String indexName, String query, FTSearchParams params) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName) - .add(query).addParams(params.dialectOptional(searchDialect.get())), new SearchResultBuilder(!params.getNoContent(), params.getWithScores(), true)); + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.SEARCH, indexName) + .add(query).addParams(params.dialectOptional(searchDialect.get())), + getSearchResultBuilder(() -> new SearchResultBuilder(!params.getNoContent(), params.getWithScores(), true))); } public final CommandObject ftSearch(String indexName, Query query) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName) - .addParams(query.dialectOptional(searchDialect.get())), - new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true)); + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.SEARCH, indexName) + .addParams(query.dialectOptional(searchDialect.get())), getSearchResultBuilder(() -> + new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true))); } + @Deprecated public final CommandObject ftSearch(byte[] indexName, Query query) { + if (protocol == RedisProtocol.RESP3) { + throw new UnsupportedOperationException("binary ft.search is not implemented with resp3."); + } return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName) - .addParams(query.dialectOptional(searchDialect.get())), - new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), false)); + .addParams(query.dialectOptional(searchDialect.get())), getSearchResultBuilder(() -> + new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), false))); } public final CommandObject ftExplain(String indexName, Query query) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.EXPLAIN), indexName) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.EXPLAIN, indexName) .addParams(query.dialectOptional(searchDialect.get())), BuilderFactory.STRING); } public final CommandObject> ftExplainCLI(String indexName, Query query) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.EXPLAINCLI), indexName) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.EXPLAINCLI, indexName) .addParams(query.dialectOptional(searchDialect.get())), BuilderFactory.STRING_LIST); } public final CommandObject ftAggregate(String indexName, AggregationBuilder aggr) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.AGGREGATE), indexName) - .addParams(aggr.dialectOptional(searchDialect.get())), !aggr.isWithCursor() ? SearchBuilderFactory.SEARCH_AGGREGATION_RESULT - : SearchBuilderFactory.SEARCH_AGGREGATION_RESULT_WITH_CURSOR); + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.AGGREGATE, indexName) + .addParams(aggr.dialectOptional(searchDialect.get())), !aggr.isWithCursor() ? AggregationResult.SEARCH_AGGREGATION_RESULT + : AggregationResult.SEARCH_AGGREGATION_RESULT_WITH_CURSOR); } public final CommandObject ftCursorRead(String indexName, long cursorId, int count) { return new CommandObject<>(commandArguments(SearchCommand.CURSOR).add(SearchKeyword.READ) - .add(indexName).add(cursorId).add(SearchKeyword.COUNT).add(count), - SearchBuilderFactory.SEARCH_AGGREGATION_RESULT_WITH_CURSOR); + .key(indexName).add(cursorId).add(SearchKeyword.COUNT).add(count), + AggregationResult.SEARCH_AGGREGATION_RESULT_WITH_CURSOR); } public final CommandObject ftCursorDel(String indexName, long cursorId) { return new CommandObject<>(commandArguments(SearchCommand.CURSOR).add(SearchKeyword.DEL) - .add(indexName).add(cursorId), BuilderFactory.STRING); + .key(indexName).add(cursorId), BuilderFactory.STRING); } public final CommandObject>> ftProfileAggregate( String indexName, FTProfileParams profileParams, AggregationBuilder aggr) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.PROFILE), indexName) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.PROFILE, indexName) .add(SearchKeyword.AGGREGATE).addParams(profileParams).add(SearchKeyword.QUERY) - .addParams(aggr.dialectOptional(searchDialect.get())), new SearchProfileResponseBuilder<>(!aggr.isWithCursor() - ? SearchBuilderFactory.SEARCH_AGGREGATION_RESULT - : SearchBuilderFactory.SEARCH_AGGREGATION_RESULT_WITH_CURSOR)); + .addParams(aggr.dialectOptional(searchDialect.get())), new SearchProfileResponseBuilder<>( + !aggr.isWithCursor() ? AggregationResult.SEARCH_AGGREGATION_RESULT + : AggregationResult.SEARCH_AGGREGATION_RESULT_WITH_CURSOR)); } public final CommandObject>> ftProfileSearch( String indexName, FTProfileParams profileParams, Query query) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.PROFILE), indexName) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.PROFILE, indexName) .add(SearchKeyword.SEARCH).addParams(profileParams).add(SearchKeyword.QUERY) .addParams(query.dialectOptional(searchDialect.get())), new SearchProfileResponseBuilder<>( - new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true))); + getSearchResultBuilder(() -> new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true)))); } public final CommandObject>> ftProfileSearch( String indexName, FTProfileParams profileParams, String query, FTSearchParams searchParams) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.PROFILE), indexName) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.PROFILE, indexName) .add(SearchKeyword.SEARCH).addParams(profileParams).add(SearchKeyword.QUERY).add(query) .addParams(searchParams.dialectOptional(searchDialect.get())), new SearchProfileResponseBuilder<>( - new SearchResultBuilder(!searchParams.getNoContent(), searchParams.getWithScores(), true))); - } - - public final CommandObject ftDropIndex(String indexName) { - return new CommandObject<>(commandArguments(SearchCommand.DROPINDEX).add(indexName), BuilderFactory.STRING); + getSearchResultBuilder(() -> new SearchResultBuilder(!searchParams.getNoContent(), searchParams.getWithScores(), true)))); } - public final CommandObject ftDropIndexDD(String indexName) { - return new CommandObject<>(commandArguments(SearchCommand.DROPINDEX).add(indexName).add(SearchKeyword.DD), - BuilderFactory.STRING); + private Builder getSearchResultBuilder(Supplier> resp2) { + if (protocol == RedisProtocol.RESP3) return SearchResult.SEARCH_RESULT_BUILDER; + return resp2.get(); } public final CommandObject ftSynUpdate(String indexName, String synonymGroupId, String... terms) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SYNUPDATE), indexName) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.SYNUPDATE, indexName) .add(synonymGroupId).addObjects((Object[]) terms), BuilderFactory.STRING); } public final CommandObject>> ftSynDump(String indexName) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SYNDUMP), indexName), + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.SYNDUMP, indexName), SearchBuilderFactory.SEARCH_SYNONYM_GROUPS); } @@ -3308,43 +3329,32 @@ public final CommandObject> ftDictDumpBySampleKey(String indexName, } public final CommandObject>> ftSpellCheck(String index, String query) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SPELLCHECK), index).add(query), + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.SPELLCHECK, index).add(query), SearchBuilderFactory.SEARCH_SPELLCHECK_RESPONSE); } public final CommandObject>> ftSpellCheck(String index, String query, FTSpellCheckParams spellCheckParams) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SPELLCHECK), index).add(query) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.SPELLCHECK, index).add(query) .addParams(spellCheckParams.dialectOptional(searchDialect.get())), SearchBuilderFactory.SEARCH_SPELLCHECK_RESPONSE); } public final CommandObject> ftInfo(String indexName) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.INFO), indexName), - BuilderFactory.ENCODED_OBJECT_MAP); + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.INFO, indexName), + protocol == RedisProtocol.RESP3 ? BuilderFactory.AGGRESSIVE_ENCODED_OBJECT_MAP : BuilderFactory.ENCODED_OBJECT_MAP); } public final CommandObject> ftTagVals(String indexName, String fieldName) { - return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.TAGVALS), indexName) + return new CommandObject<>(checkAndRoundRobinSearchCommand(SearchCommand.TAGVALS, indexName) .add(fieldName), BuilderFactory.STRING_SET); } - public final CommandObject ftAliasAdd(String aliasName, String indexName) { - return new CommandObject<>(commandArguments(SearchCommand.ALIASADD).add(aliasName).add(indexName), BuilderFactory.STRING); - } - - public final CommandObject ftAliasUpdate(String aliasName, String indexName) { - return new CommandObject<>(commandArguments(SearchCommand.ALIASUPDATE).add(aliasName).add(indexName), BuilderFactory.STRING); + public final CommandObject> ftConfigGet(String option) { + return new CommandObject<>(commandArguments(SearchCommand.CONFIG).add(SearchKeyword.GET).add(option), + protocol == RedisProtocol.RESP3 ? BuilderFactory.AGGRESSIVE_ENCODED_OBJECT_MAP : BuilderFactory.ENCODED_OBJECT_MAP_FROM_PAIRS); } - public final CommandObject ftAliasDel(String aliasName) { - return new CommandObject<>(commandArguments(SearchCommand.ALIASDEL).add(aliasName), BuilderFactory.STRING); - } - - public final CommandObject> ftConfigGet(String option) { - return new CommandObject<>(commandArguments(SearchCommand.CONFIG).add(SearchKeyword.GET).add(option), BuilderFactory.STRING_MAP_FROM_PAIRS); - } - - public final CommandObject> ftConfigGet(String indexName, String option) { + public final CommandObject> ftConfigGet(String indexName, String option) { return directSearchCommand(ftConfigGet(option), indexName); } @@ -3396,8 +3406,8 @@ public final CommandObject ftSugLen(String key) { return new CommandObject<>(commandArguments(SearchCommand.SUGLEN).key(key), BuilderFactory.LONG); } - public final CommandObject> ftList() { - return new CommandObject<>(commandArguments(SearchCommand._LIST), BuilderFactory.STRING_LIST); + public final CommandObject> ftList() { + return new CommandObject<>(commandArguments(SearchCommand._LIST), BuilderFactory.STRING_SET); } // RediSearch commands @@ -3411,11 +3421,13 @@ public final CommandObject jsonSetWithEscape(String key, Path2 path, Obj getJsonObjectMapper().toJson(object)), BuilderFactory.STRING); } + @Deprecated public final CommandObject jsonSet(String key, Path path, Object pojo) { return new CommandObject<>(commandArguments(JsonCommand.SET).key(key).add(path).add( getJsonObjectMapper().toJson(pojo)), BuilderFactory.STRING); } + @Deprecated public final CommandObject jsonSetWithPlainString(String key, Path path, String string) { return new CommandObject<>(commandArguments(JsonCommand.SET).key(key).add(path).add(string), BuilderFactory.STRING); } @@ -3429,6 +3441,7 @@ public final CommandObject jsonSetWithEscape(String key, Path2 path, Obj getJsonObjectMapper().toJson(object)).addParams(params), BuilderFactory.STRING); } + @Deprecated public final CommandObject jsonSet(String key, Path path, Object pojo, JsonSetParams params) { return new CommandObject<>(commandArguments(JsonCommand.SET).key(key).add(path).add( getJsonObjectMapper().toJson(pojo)).addParams(params), BuilderFactory.STRING); @@ -3438,15 +3451,18 @@ public final CommandObject jsonMerge(String key, Path2 path, Object obje return new CommandObject<>(commandArguments(JsonCommand.MERGE).key(key).add(path).add(object), BuilderFactory.STRING); } + @Deprecated public final CommandObject jsonMerge(String key, Path path, Object pojo) { return new CommandObject<>(commandArguments(JsonCommand.MERGE).key(key).add(path).add( getJsonObjectMapper().toJson(pojo)), BuilderFactory.STRING); } public final CommandObject jsonGet(String key) { - return new CommandObject<>(commandArguments(JsonCommand.GET).key(key), new JsonObjectBuilder<>(Object.class)); + return new CommandObject<>(commandArguments(JsonCommand.GET).key(key), + protocol != RedisProtocol.RESP3 ? JSON_GENERIC_OBJECT : JsonBuilderFactory.JSON_OBJECT); } + @Deprecated public final CommandObject jsonGet(String key, Class clazz) { return new CommandObject<>(commandArguments(JsonCommand.GET).key(key), new JsonObjectBuilder<>(clazz)); } @@ -3455,14 +3471,17 @@ public final CommandObject jsonGet(String key, Path2... paths) { return new CommandObject<>(commandArguments(JsonCommand.GET).key(key).addObjects((Object[]) paths), JsonBuilderFactory.JSON_OBJECT); } + @Deprecated public final CommandObject jsonGet(String key, Path... paths) { - return new CommandObject<>(commandArguments(JsonCommand.GET).key(key).addObjects((Object[]) paths), new JsonObjectBuilder<>(Object.class)); + return new CommandObject<>(commandArguments(JsonCommand.GET).key(key).addObjects((Object[]) paths), JSON_GENERIC_OBJECT); } + @Deprecated public final CommandObject jsonGetAsPlainString(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.GET).key(key).add(path), BuilderFactory.STRING); } + @Deprecated public final CommandObject jsonGet(String key, Class clazz, Path... paths) { return new CommandObject<>(commandArguments(JsonCommand.GET).key(key).addObjects((Object[]) paths), new JsonObjectBuilder<>(clazz)); } @@ -3471,6 +3490,7 @@ public final CommandObject> jsonMGet(Path2 path, String... keys) return new CommandObject<>(commandArguments(JsonCommand.MGET).keys((Object[]) keys).add(path), JsonBuilderFactory.JSON_ARRAY_LIST); } + @Deprecated public final CommandObject> jsonMGet(Path path, Class clazz, String... keys) { return new CommandObject<>(commandArguments(JsonCommand.MGET).keys((Object[]) keys).add(path), new JsonObjectListBuilder<>(clazz)); } @@ -3483,6 +3503,7 @@ public final CommandObject jsonDel(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.DEL).key(key).add(path), BuilderFactory.LONG); } + @Deprecated public final CommandObject jsonDel(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.DEL).key(key).add(path), BuilderFactory.LONG); } @@ -3495,6 +3516,7 @@ public final CommandObject jsonClear(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.CLEAR).key(key).add(path), BuilderFactory.LONG); } + @Deprecated public final CommandObject jsonClear(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.CLEAR).key(key).add(path), BuilderFactory.LONG); } @@ -3503,22 +3525,27 @@ public final CommandObject> jsonToggle(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.TOGGLE).key(key).add(path), BuilderFactory.BOOLEAN_LIST); } + @Deprecated public final CommandObject jsonToggle(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.TOGGLE).key(key).add(path), BuilderFactory.STRING); } + @Deprecated public final CommandObject> jsonType(String key) { return new CommandObject<>(commandArguments(JsonCommand.TYPE).key(key), JsonBuilderFactory.JSON_TYPE); } public final CommandObject>> jsonType(String key, Path2 path) { - return new CommandObject<>(commandArguments(JsonCommand.TYPE).key(key).add(path), JsonBuilderFactory.JSON_TYPE_LIST); + return new CommandObject<>(commandArguments(JsonCommand.TYPE).key(key).add(path), + protocol != RedisProtocol.RESP3 ? JsonBuilderFactory.JSON_TYPE_LIST : JsonBuilderFactory.JSON_TYPE_RESPONSE_RESP3_COMPATIBLE); } + @Deprecated public final CommandObject> jsonType(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.TYPE).key(key).add(path), JsonBuilderFactory.JSON_TYPE); } + @Deprecated public final CommandObject jsonStrAppend(String key, Object string) { return new CommandObject<>(commandArguments(JsonCommand.STRAPPEND).key(key).add( getJsonObjectMapper().toJson(string)), BuilderFactory.LONG); @@ -3529,11 +3556,13 @@ public final CommandObject> jsonStrAppend(String key, Path2 path, Obj getJsonObjectMapper().toJson(string)), BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject jsonStrAppend(String key, Path path, Object string) { return new CommandObject<>(commandArguments(JsonCommand.STRAPPEND).key(key).add(path).add( getJsonObjectMapper().toJson(string)), BuilderFactory.LONG); } + @Deprecated public final CommandObject jsonStrLen(String key) { return new CommandObject<>(commandArguments(JsonCommand.STRLEN).key(key), BuilderFactory.LONG); } @@ -3542,14 +3571,17 @@ public final CommandObject> jsonStrLen(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.STRLEN).key(key).add(path), BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject jsonStrLen(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.STRLEN).key(key).add(path), BuilderFactory.LONG); } - public final CommandObject jsonNumIncrBy(String key, Path2 path, double value) { - return new CommandObject<>(commandArguments(JsonCommand.NUMINCRBY).key(key).add(path).add(value), JsonBuilderFactory.JSON_ARRAY); + public final CommandObject jsonNumIncrBy(String key, Path2 path, double value) { + return new CommandObject<>(commandArguments(JsonCommand.NUMINCRBY).key(key).add(path).add(value), + JsonBuilderFactory.JSON_ARRAY_OR_DOUBLE_LIST); } + @Deprecated public final CommandObject jsonNumIncrBy(String key, Path path, double value) { return new CommandObject<>(commandArguments(JsonCommand.NUMINCRBY).key(key).add(path).add(value), BuilderFactory.DOUBLE); } @@ -3575,6 +3607,7 @@ public final CommandObject> jsonArrAppendWithEscape(String key, Path2 return new CommandObject<>(args, BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject jsonArrAppend(String key, Path path, Object... pojos) { CommandArguments args = commandArguments(JsonCommand.ARRAPPEND).key(key).add(path); for (Object pojo : pojos) { @@ -3592,6 +3625,7 @@ public final CommandObject> jsonArrIndexWithEscape(String key, Path2 getJsonObjectMapper().toJson(scalar)), BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject jsonArrIndex(String key, Path path, Object scalar) { return new CommandObject<>(commandArguments(JsonCommand.ARRINDEX).key(key).add(path).add( getJsonObjectMapper().toJson(scalar)), BuilderFactory.LONG); @@ -3610,6 +3644,7 @@ public final CommandObject> jsonArrInsertWithEscape(String key, Path2 return new CommandObject<>(args, BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject jsonArrInsert(String key, Path path, int index, Object... pojos) { CommandArguments args = commandArguments(JsonCommand.ARRINSERT).key(key).add(path).add(index); for (Object pojo : pojos) { @@ -3618,10 +3653,12 @@ public final CommandObject jsonArrInsert(String key, Path path, int index, return new CommandObject<>(args, BuilderFactory.LONG); } + @Deprecated public final CommandObject jsonArrPop(String key) { return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key), new JsonObjectBuilder<>(Object.class)); } + @Deprecated public final CommandObject jsonArrPop(String key, Class clazz) { return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key), new JsonObjectBuilder<>(clazz)); } @@ -3630,10 +3667,12 @@ public final CommandObject> jsonArrPop(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key).add(path), new JsonObjectListBuilder<>(Object.class)); } + @Deprecated public final CommandObject jsonArrPop(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key).add(path), new JsonObjectBuilder<>(Object.class)); } + @Deprecated public final CommandObject jsonArrPop(String key, Class clazz, Path path) { return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key).add(path), new JsonObjectBuilder<>(clazz)); } @@ -3642,14 +3681,17 @@ public final CommandObject> jsonArrPop(String key, Path2 path, int return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key).add(path).add(index), new JsonObjectListBuilder<>(Object.class)); } + @Deprecated public final CommandObject jsonArrPop(String key, Path path, int index) { return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key).add(path).add(index), new JsonObjectBuilder<>(Object.class)); } + @Deprecated public final CommandObject jsonArrPop(String key, Class clazz, Path path, int index) { return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key).add(path).add(index), new JsonObjectBuilder<>(clazz)); } + @Deprecated public final CommandObject jsonArrLen(String key) { return new CommandObject<>(commandArguments(JsonCommand.ARRLEN).key(key), BuilderFactory.LONG); } @@ -3658,6 +3700,7 @@ public final CommandObject> jsonArrLen(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.ARRLEN).key(key).add(path), BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject jsonArrLen(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.ARRLEN).key(key).add(path), BuilderFactory.LONG); } @@ -3666,14 +3709,17 @@ public final CommandObject> jsonArrTrim(String key, Path2 path, int s return new CommandObject<>(commandArguments(JsonCommand.ARRTRIM).key(key).add(path).add(start).add(stop), BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject jsonArrTrim(String key, Path path, int start, int stop) { return new CommandObject<>(commandArguments(JsonCommand.ARRTRIM).key(key).add(path).add(start).add(stop), BuilderFactory.LONG); } + @Deprecated public final CommandObject jsonObjLen(String key) { return new CommandObject<>(commandArguments(JsonCommand.OBJLEN).key(key), BuilderFactory.LONG); } + @Deprecated public final CommandObject jsonObjLen(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.OBJLEN).key(key).add(path), BuilderFactory.LONG); } @@ -3682,10 +3728,12 @@ public final CommandObject> jsonObjLen(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.OBJLEN).key(key).add(path), BuilderFactory.LONG_LIST); } + @Deprecated public final CommandObject> jsonObjKeys(String key) { return new CommandObject<>(commandArguments(JsonCommand.OBJKEYS).key(key), BuilderFactory.STRING_LIST); } + @Deprecated public final CommandObject> jsonObjKeys(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.OBJKEYS).key(key).add(path), BuilderFactory.STRING_LIST); } @@ -3694,10 +3742,12 @@ public final CommandObject>> jsonObjKeys(String key, Path2 pat return new CommandObject<>(commandArguments(JsonCommand.OBJKEYS).key(key).add(path), BuilderFactory.STRING_LIST_LIST); } + @Deprecated public final CommandObject jsonDebugMemory(String key) { return new CommandObject<>(commandArguments(JsonCommand.DEBUG).add("MEMORY").key(key), BuilderFactory.LONG); } + @Deprecated public final CommandObject jsonDebugMemory(String key, Path path) { return new CommandObject<>(commandArguments(JsonCommand.DEBUG).add("MEMORY").key(key).add(path), BuilderFactory.LONG); } @@ -3705,18 +3755,6 @@ public final CommandObject jsonDebugMemory(String key, Path path) { public final CommandObject> jsonDebugMemory(String key, Path2 path) { return new CommandObject<>(commandArguments(JsonCommand.DEBUG).add("MEMORY").key(key).add(path), BuilderFactory.LONG_LIST); } - - public final CommandObject> jsonResp(String key) { - return new CommandObject<>(commandArguments(JsonCommand.RESP).key(key), BuilderFactory.ENCODED_OBJECT_LIST); - } - - public final CommandObject> jsonResp(String key, Path path) { - return new CommandObject<>(commandArguments(JsonCommand.RESP).key(key).add(path), BuilderFactory.ENCODED_OBJECT_LIST); - } - - public final CommandObject>> jsonResp(String key, Path2 path) { - return new CommandObject<>(commandArguments(JsonCommand.RESP).key(key).add(path), BuilderFactory.ENCODED_OBJECT_LIST_LIST); - } // RedisJSON commands // RedisTimeSeries commands @@ -3829,7 +3867,7 @@ public final CommandObject tsGet(String key, TSGetParams getParams) { public final CommandObject> tsMGet(TSMGetParams multiGetParams, String... filters) { return new CommandObject<>(commandArguments(TimeSeriesCommand.MGET).addParams(multiGetParams) .add(TimeSeriesKeyword.FILTER).addObjects((Object[]) filters), - proto == RedisProtocol.RESP3 ? TimeSeriesBuilderFactory.TIMESERIES_MGET_RESPONSE_RESP3 + protocol == RedisProtocol.RESP3 ? TimeSeriesBuilderFactory.TIMESERIES_MGET_RESPONSE_RESP3 : TimeSeriesBuilderFactory.TIMESERIES_MGET_RESPONSE); } @@ -3864,12 +3902,12 @@ public final CommandObject tsInfoDebug(String key) { } private Builder> getTimeseriesMultiRangeResponseBuilder() { - return proto == RedisProtocol.RESP3 ? TimeSeriesBuilderFactory.TIMESERIES_MRANGE_RESPONSE_RESP3 + return protocol == RedisProtocol.RESP3 ? TimeSeriesBuilderFactory.TIMESERIES_MRANGE_RESPONSE_RESP3 : TimeSeriesBuilderFactory.TIMESERIES_MRANGE_RESPONSE; } private Builder getTimeseriesInfoBuilder() { - return proto == RedisProtocol.RESP3 ? TSInfo.TIMESERIES_INFO_RESP3 : TSInfo.TIMESERIES_INFO; + return protocol == RedisProtocol.RESP3 ? TSInfo.TIMESERIES_INFO_RESP3 : TSInfo.TIMESERIES_INFO; } // RedisTimeSeries commands @@ -3994,11 +4032,13 @@ public final CommandObject> cfInfo(String key) { } public final CommandObject cmsInitByDim(String key, long width, long depth) { - return new CommandObject<>(commandArguments(CountMinSketchCommand.INITBYDIM).key(key).add(width).add(depth), BuilderFactory.STRING); + return new CommandObject<>(commandArguments(CountMinSketchCommand.INITBYDIM).key(key).add(width) + .add(depth), BuilderFactory.STRING); } public final CommandObject cmsInitByProb(String key, double error, double probability) { - return new CommandObject<>(commandArguments(CountMinSketchCommand.INITBYPROB).key(key).add(error).add(probability), BuilderFactory.STRING); + return new CommandObject<>(commandArguments(CountMinSketchCommand.INITBYPROB).key(key).add(error) + .add(probability), BuilderFactory.STRING); } public final CommandObject> cmsIncrBy(String key, Map itemIncrements) { @@ -4008,7 +4048,8 @@ public final CommandObject> cmsIncrBy(String key, Map i } public final CommandObject> cmsQuery(String key, String... items) { - return new CommandObject<>(commandArguments(CountMinSketchCommand.QUERY).key(key).addObjects((Object[]) items), BuilderFactory.LONG_LIST); + return new CommandObject<>(commandArguments(CountMinSketchCommand.QUERY).key(key) + .addObjects((Object[]) items), BuilderFactory.LONG_LIST); } public final CommandObject cmsMerge(String destKey, String... keys) { @@ -4056,6 +4097,11 @@ public final CommandObject> topkList(String key) { return new CommandObject<>(commandArguments(TopKCommand.LIST).key(key), BuilderFactory.STRING_LIST); } + public final CommandObject> topkListWithCount(String key) { + return new CommandObject<>(commandArguments(TopKCommand.LIST).key(key) + .add(RedisBloomKeyword.WITHCOUNT), BuilderFactory.STRING_LONG_MAP); + } + public final CommandObject> topkInfo(String key) { return new CommandObject<>(commandArguments(TopKCommand.INFO).key(key), BuilderFactory.ENCODED_OBJECT_MAP); } @@ -4138,31 +4184,64 @@ public final CommandObject> tdigestByRevRank(String key, long... ra // RedisBloom commands // RedisGraph commands + @Deprecated public final CommandObject> graphList() { return new CommandObject<>(commandArguments(GraphCommand.LIST), BuilderFactory.STRING_LIST); } + @Deprecated public final CommandObject> graphProfile(String graphName, String query) { return new CommandObject<>(commandArguments(GraphCommand.PROFILE).key(graphName).add(query), BuilderFactory.STRING_LIST); } + @Deprecated public final CommandObject> graphExplain(String graphName, String query) { return new CommandObject<>(commandArguments(GraphCommand.EXPLAIN).key(graphName).add(query), BuilderFactory.STRING_LIST); } + @Deprecated public final CommandObject>> graphSlowlog(String graphName) { return new CommandObject<>(commandArguments(GraphCommand.SLOWLOG).key(graphName), BuilderFactory.ENCODED_OBJECT_LIST_LIST); } + @Deprecated public final CommandObject graphConfigSet(String configName, Object value) { return new CommandObject<>(commandArguments(GraphCommand.CONFIG).add(GraphKeyword.SET).add(configName).add(value), BuilderFactory.STRING); } + @Deprecated public final CommandObject> graphConfigGet(String configName) { return new CommandObject<>(commandArguments(GraphCommand.CONFIG).add(GraphKeyword.GET).add(configName), BuilderFactory.ENCODED_OBJECT_MAP); } // RedisGraph commands + // RedisGears commands + public final CommandObject tFunctionLoad(String libraryCode, TFunctionLoadParams params) { + return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.LOAD) + .addParams(params).add(libraryCode), BuilderFactory.STRING); + } + + public final CommandObject tFunctionDelete(String libraryName) { + return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.DELETE) + .add(libraryName), BuilderFactory.STRING); + } + + public final CommandObject> tFunctionList(TFunctionListParams params) { + return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.LIST) + .addParams(params), GearsLibraryInfo.GEARS_LIBRARY_INFO_LIST); + } + + public final CommandObject tFunctionCall(String library, String function, List keys, List args) { + return new CommandObject<>(commandArguments(GearsCommand.TFCALL).add(library + "." + function) + .add(keys.size()).keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); + } + + public final CommandObject tFunctionCallAsync(String library, String function, List keys, List args) { + return new CommandObject<>(commandArguments(GearsCommand.TFCALLASYNC).add(library + "." + function) + .add(keys.size()).keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); + } + // RedisGears commands + /** * Get the instance for JsonObjectMapper if not null, otherwise a new instance reference with * default implementation will be created and returned. @@ -4198,6 +4277,8 @@ public void setDefaultSearchDialect(int dialect) { private class SearchProfileResponseBuilder extends Builder>> { + private static final String PROFILE_STR = "profile"; + private final Builder replyBuilder; public SearchProfileResponseBuilder(Builder replyBuilder) { @@ -4206,7 +4287,18 @@ public SearchProfileResponseBuilder(Builder replyBuilder) { @Override public Map.Entry> build(Object data) { - List list = (List) data; + List list = (List) data; + if (list == null || list.isEmpty()) return null; + + if (list.get(0) instanceof KeyValue) { + for (KeyValue keyValue : (List) data) { + if (PROFILE_STR.equals(BuilderFactory.STRING.build(keyValue.getKey()))) { + return KeyValue.of(replyBuilder.build(data), + BuilderFactory.AGGRESSIVE_ENCODED_OBJECT_MAP.build(keyValue.getValue())); + } + } + } + return KeyValue.of(replyBuilder.build(list.get(0)), SearchBuilderFactory.SEARCH_PROFILE_PROFILE.build(list.get(1))); } @@ -4226,6 +4318,11 @@ public T build(Object data) { } } + /** + * {@link JsonObjectBuilder} for {@code Object.class}. + */ + private final Builder JSON_GENERIC_OBJECT = new JsonObjectBuilder<>(Object.class); + private class JsonObjectListBuilder extends Builder> { private final Class clazz; diff --git a/src/main/java/redis/clients/jedis/Connection.java b/src/main/java/redis/clients/jedis/Connection.java index a0a342e8ab..50243e20d7 100644 --- a/src/main/java/redis/clients/jedis/Connection.java +++ b/src/main/java/redis/clients/jedis/Connection.java @@ -1,5 +1,7 @@ package redis.clients.jedis; +import static redis.clients.jedis.util.SafeEncoder.encode; + import java.io.Closeable; import java.io.IOException; import java.net.Socket; @@ -9,7 +11,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.function.Supplier; import redis.clients.jedis.Protocol.Command; @@ -22,10 +23,8 @@ import redis.clients.jedis.exceptions.JedisException; import redis.clients.jedis.exceptions.JedisValidationException; import redis.clients.jedis.util.IOUtils; -import redis.clients.jedis.util.JedisMetaInfo; import redis.clients.jedis.util.RedisInputStream; import redis.clients.jedis.util.RedisOutputStream; -import redis.clients.jedis.util.SafeEncoder; public class Connection implements Closeable { @@ -73,7 +72,7 @@ public String toString() { return "Connection{" + socketFactory + "}"; } - final RedisProtocol getRedisProtocol() { + public final RedisProtocol getRedisProtocol() { return protocol; } @@ -270,14 +269,14 @@ public String getStatusCodeReply() { if (null == resp) { return null; } else { - return SafeEncoder.encode(resp); + return encode(resp); } } public String getBulkReply() { final byte[] result = getBinaryBulkReply(); if (null != result) { - return SafeEncoder.encode(result); + return encode(result); } else { return null; } @@ -388,66 +387,64 @@ private static boolean validateClientInfo(String info) { return true; } - private void initializeFromClientConfig(JedisClientConfig config) { + private void initializeFromClientConfig(final JedisClientConfig config) { try { connect(); - protocol = config.getRedisProtocol(); - - boolean doClientName = true; - /// HELLO and AUTH --> - if (protocol == RedisProtocol.RESP3 && config.getUser() != null) { - - hello(protocol, config.getUser(), config.getPassword(), config.getClientName()); - doClientName = false; - - } else { - - Supplier credentialsProvider = config.getCredentialsProvider(); - if (credentialsProvider instanceof RedisCredentialsProvider) { - try { - ((RedisCredentialsProvider) credentialsProvider).prepare(); - auth(credentialsProvider); - } finally { - ((RedisCredentialsProvider) credentialsProvider).cleanUp(); - } - } else { - auth(credentialsProvider); - } + protocol = config.getRedisProtocol(); - if (protocol != null) { - hello(protocol); + final Supplier credentialsProvider = config.getCredentialsProvider(); + if (credentialsProvider instanceof RedisCredentialsProvider) { + final RedisCredentialsProvider redisCredentialsProvider = (RedisCredentialsProvider) credentialsProvider; + try { + redisCredentialsProvider.prepare(); + helloOrAuth(protocol, redisCredentialsProvider.get()); + } finally { + redisCredentialsProvider.cleanUp(); } - } - - int dbIndex = config.getDatabase(); - if (dbIndex > 0) { - select(dbIndex); + } else { + helloOrAuth(protocol, credentialsProvider != null ? credentialsProvider.get() + : new DefaultRedisCredentials(config.getUser(), config.getPassword())); } List fireAndForgetMsg = new ArrayList<>(); String clientName = config.getClientName(); - if (doClientName && clientName != null && validateClientInfo(clientName)) { + if (clientName != null && validateClientInfo(clientName)) { fireAndForgetMsg.add(new CommandArguments(Command.CLIENT).add(Keyword.SETNAME).add(clientName)); } - String libName = JedisMetaInfo.getArtifactId(); - if (libName != null && validateClientInfo(libName)) { - fireAndForgetMsg.add(new CommandArguments(Command.CLIENT).add(Keyword.SETINFO) - .add(ClientAttributeOption.LIB_NAME.getRaw()).add(libName)); - } + ClientSetInfoConfig setInfoConfig = config.getClientSetInfoConfig(); + if (setInfoConfig == null) setInfoConfig = ClientSetInfoConfig.DEFAULT; - String libVersion = JedisMetaInfo.getVersion(); - if (libVersion != null && validateClientInfo(libVersion)) { - fireAndForgetMsg.add(new CommandArguments(Command.CLIENT).add(Keyword.SETINFO) - .add(ClientAttributeOption.LIB_VER.getRaw()).add(libVersion)); + if (!setInfoConfig.isDisabled()) { + String libName = JedisMetaInfo.getArtifactId(); + if (libName != null && validateClientInfo(libName)) { + String libNameSuffix = setInfoConfig.getLibNameSuffix(); + if (libNameSuffix != null) { // validation is moved into ClientSetInfoConfig constructor + libName = libName + '(' + libNameSuffix + ')'; + } + fireAndForgetMsg.add(new CommandArguments(Command.CLIENT).add(Keyword.SETINFO) + .add(ClientAttributeOption.LIB_NAME.getRaw()).add(libName)); + } + + String libVersion = JedisMetaInfo.getVersion(); + if (libVersion != null && validateClientInfo(libVersion)) { + fireAndForgetMsg.add(new CommandArguments(Command.CLIENT).add(Keyword.SETINFO) + .add(ClientAttributeOption.LIB_VER.getRaw()).add(libVersion)); + } } for (CommandArguments arg : fireAndForgetMsg) { sendCommand(arg); } getMany(fireAndForgetMsg.size()); + + int dbIndex = config.getDatabase(); + if (dbIndex > 0) { + select(dbIndex); + } + } catch (JedisException je) { try { disconnect(); @@ -458,58 +455,59 @@ private void initializeFromClientConfig(JedisClientConfig config) { } } - private Map hello(final RedisProtocol protocol) { - sendCommand(Protocol.Command.HELLO, String.valueOf(protocol.version())); - Map reply = BuilderFactory.ENCODED_OBJECT_MAP.build(getOne()); - // LoggerFactory.getLogger(Connection.class).info("HELLO reply: {}", reply); - return reply; - } + private void helloOrAuth(final RedisProtocol protocol, final RedisCredentials credentials) { - private Map hello(final RedisProtocol protocol, final String user, final String password, - final String clientName) { - if (clientName == null) { - sendCommand(Protocol.Command.HELLO, String.valueOf(protocol.version()), - Protocol.Keyword.AUTH.name(), user, password); - } else { - sendCommand(Protocol.Command.HELLO, String.valueOf(protocol.version()), - Protocol.Keyword.AUTH.name(), user, password, - Protocol.Keyword.SETNAME.name(), clientName); + if (credentials == null || credentials.getPassword() == null) { + if (protocol != null) { + sendCommand(Command.HELLO, encode(protocol.version())); + getOne(); + } + return; } - Map reply = BuilderFactory.ENCODED_OBJECT_MAP.build(getOne()); - // LoggerFactory.getLogger(Connection.class).info("HELLO reply: {}", reply); - return reply; - } - - private void auth(final Supplier credentialsProvider) { - RedisCredentials credentials = credentialsProvider.get(); - if (credentials == null || credentials.getPassword() == null) return; // Source: https://stackoverflow.com/a/9670279/4021802 ByteBuffer passBuf = Protocol.CHARSET.encode(CharBuffer.wrap(credentials.getPassword())); byte[] rawPass = Arrays.copyOfRange(passBuf.array(), passBuf.position(), passBuf.limit()); Arrays.fill(passBuf.array(), (byte) 0); // clear sensitive data - if (credentials.getUser() != null) { - sendCommand(Protocol.Command.AUTH, SafeEncoder.encode(credentials.getUser()), rawPass); - } else { - sendCommand(Protocol.Command.AUTH, rawPass); - } + try { + /// actual HELLO or AUTH --> + if (protocol != null) { + if (credentials.getUser() != null) { + sendCommand(Command.HELLO, encode(protocol.version()), + Keyword.AUTH.getRaw(), encode(credentials.getUser()), rawPass); + getOne(); // Map + } else { + sendCommand(Command.AUTH, rawPass); + getStatusCodeReply(); // OK + sendCommand(Command.HELLO, encode(protocol.version())); + getOne(); // Map + } + } else { // protocol == null + if (credentials.getUser() != null) { + sendCommand(Command.AUTH, encode(credentials.getUser()), rawPass); + } else { + sendCommand(Command.AUTH, rawPass); + } + getStatusCodeReply(); // OK + } + /// <-- actual HELLO or AUTH + } finally { - Arrays.fill(rawPass, (byte) 0); // clear sensitive data + Arrays.fill(rawPass, (byte) 0); // clear sensitive data + } // clearing 'char[] credentials.getPassword()' should be // handled in RedisCredentialsProvider.cleanUp() - - getStatusCodeReply(); // OK } public String select(final int index) { - sendCommand(Protocol.Command.SELECT, Protocol.toByteArray(index)); + sendCommand(Command.SELECT, Protocol.toByteArray(index)); return getStatusCodeReply(); } public boolean ping() { - sendCommand(Protocol.Command.PING); + sendCommand(Command.PING); String status = getStatusCodeReply(); if (!"PONG".equals(status)) { throw new JedisException(status); diff --git a/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java b/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java index 5f0b4866f1..6d62646a5e 100644 --- a/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java +++ b/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java @@ -24,10 +24,13 @@ public final class DefaultJedisClientConfig implements JedisClientConfig { private final HostAndPortMapper hostAndPortMapper; + private final ClientSetInfoConfig clientSetInfoConfig; + private DefaultJedisClientConfig(RedisProtocol protocol, int connectionTimeoutMillis, int soTimeoutMillis, int blockingSocketTimeoutMillis, Supplier credentialsProvider, int database, String clientName, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, - HostnameVerifier hostnameVerifier, HostAndPortMapper hostAndPortMapper) { + HostnameVerifier hostnameVerifier, HostAndPortMapper hostAndPortMapper, + ClientSetInfoConfig clientSetInfoConfig) { this.redisProtocol = protocol; this.connectionTimeoutMillis = connectionTimeoutMillis; this.socketTimeoutMillis = soTimeoutMillis; @@ -40,6 +43,7 @@ private DefaultJedisClientConfig(RedisProtocol protocol, int connectionTimeoutMi this.sslParameters = sslParameters; this.hostnameVerifier = hostnameVerifier; this.hostAndPortMapper = hostAndPortMapper; + this.clientSetInfoConfig = clientSetInfoConfig; } @Override @@ -113,6 +117,11 @@ public HostAndPortMapper getHostAndPortMapper() { return hostAndPortMapper; } + @Override + public ClientSetInfoConfig getClientSetInfoConfig() { + return clientSetInfoConfig; + } + public static Builder builder() { return new Builder(); } @@ -138,6 +147,8 @@ public static class Builder { private HostAndPortMapper hostAndPortMapper = null; + private ClientSetInfoConfig clientSetInfoConfig = ClientSetInfoConfig.DEFAULT; + private Builder() { } @@ -149,7 +160,7 @@ public DefaultJedisClientConfig build() { return new DefaultJedisClientConfig(redisProtocol, connectionTimeoutMillis, socketTimeoutMillis, blockingSocketTimeoutMillis, credentialsProvider, database, clientName, ssl, - sslSocketFactory, sslParameters, hostnameVerifier, hostAndPortMapper); + sslSocketFactory, sslParameters, hostnameVerifier, hostAndPortMapper, clientSetInfoConfig); } /** @@ -239,6 +250,11 @@ public Builder hostAndPortMapper(HostAndPortMapper hostAndPortMapper) { this.hostAndPortMapper = hostAndPortMapper; return this; } + + public Builder clientSetInfoConfig(ClientSetInfoConfig setInfoConfig) { + this.clientSetInfoConfig = setInfoConfig; + return this; + } } public static DefaultJedisClientConfig create(int connectionTimeoutMillis, int soTimeoutMillis, @@ -248,7 +264,7 @@ public static DefaultJedisClientConfig create(int connectionTimeoutMillis, int s return new DefaultJedisClientConfig(null, connectionTimeoutMillis, soTimeoutMillis, blockingSocketTimeoutMillis, new DefaultRedisCredentialsProvider(new DefaultRedisCredentials(user, password)), database, - clientName, ssl, sslSocketFactory, sslParameters, hostnameVerifier, hostAndPortMapper); + clientName, ssl, sslSocketFactory, sslParameters, hostnameVerifier, hostAndPortMapper, null); } public static DefaultJedisClientConfig copyConfig(JedisClientConfig copy) { @@ -256,6 +272,7 @@ public static DefaultJedisClientConfig copyConfig(JedisClientConfig copy) { copy.getConnectionTimeoutMillis(), copy.getSocketTimeoutMillis(), copy.getBlockingSocketTimeoutMillis(), copy.getCredentialsProvider(), copy.getDatabase(), copy.getClientName(), copy.isSsl(), copy.getSslSocketFactory(), - copy.getSslParameters(), copy.getHostnameVerifier(), copy.getHostAndPortMapper()); + copy.getSslParameters(), copy.getHostnameVerifier(), copy.getHostAndPortMapper(), + copy.getClientSetInfoConfig()); } } diff --git a/src/main/java/redis/clients/jedis/DefaultJedisSocketFactory.java b/src/main/java/redis/clients/jedis/DefaultJedisSocketFactory.java index f9c7cd2228..a2d963e221 100644 --- a/src/main/java/redis/clients/jedis/DefaultJedisSocketFactory.java +++ b/src/main/java/redis/clients/jedis/DefaultJedisSocketFactory.java @@ -70,7 +70,9 @@ private Socket connectToFirstSuccessfulHost(HostAndPort hostAndPort) throws Exce socket.setTcpNoDelay(true); // Socket buffer Whetherclosed, to ensure timely delivery of data socket.setSoLinger(true, 0); // Control calls close () method, the underlying socket is closed immediately - socket.connect(new InetSocketAddress(host.getHostAddress(), hostAndPort.getPort()), connectionTimeout); + // Passing 'host' directly will avoid another call to InetAddress.getByName() inside the InetSocketAddress constructor. + // For machines with ipv4 and ipv6, but the startNode uses ipv4 to connect, the ipv6 connection may fail. + socket.connect(new InetSocketAddress(host, hostAndPort.getPort()), connectionTimeout); return socket; } catch (Exception e) { jce.addSuppressed(e); diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index e8c15864e3..181fe279a2 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -352,7 +352,7 @@ public byte[] ping(final byte[] message) { /** * Select the DB with having the specified zero-based numeric index. For default every new - * connection connection is automatically selected to DB 0. + * connection is automatically selected to DB 0. * @param index * @return OK */ @@ -569,7 +569,7 @@ public long del(final byte[] key) { /** * This command is very similar to DEL: it removes the specified keys. Just like DEL a key is - * ignored if it does not exist. However the command performs the actual memory reclaiming in a + * ignored if it does not exist. However, the command performs the actual memory reclaiming in a * different thread, so it is not blocking, while DEL is. This is where the command name comes * from: the command just unlinks the keys from the keyspace. The actual removal will happen later * asynchronously. @@ -925,7 +925,7 @@ public String setex(final byte[] key, final long seconds, final byte[] value) { } /** - * Set the the respective keys to the respective values. MSET will replace old values with new + * Set the respective keys to the respective values. MSET will replace old values with new * values, while {@link Jedis#msetnx(byte[][]) MSETNX} will not perform any operation at all even * if just a single key already exists. *

@@ -973,10 +973,10 @@ public long msetnx(final byte[]... keysvalues) { * DECRBY work just like {@link Jedis#decr(byte[]) DECR} but instead to decrement by 1 the * decrement is integer. *

- * DECR commands are limited to 64 bit signed integers. + * DECR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -997,10 +997,10 @@ public long decrBy(final byte[] key, final long decrement) { * Decrement the number stored at key by one. If the key does not exist or contains a value of a * wrong type, set the key to the value of "0" before to perform the decrement operation. *

- * DECR commands are limited to 64 bit signed integers. + * DECR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -1020,10 +1020,10 @@ public long decr(final byte[] key) { * INCRBY work just like {@link Jedis#incr(byte[]) INCR} but instead to increment by 1 the * increment is integer. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -1069,10 +1069,10 @@ public double incrByFloat(final byte[] key, final double increment) { * Increment the number stored at key by one. If the key does not exist or contains a value of a * wrong type, set the key to the value of "0" before to perform the increment operation. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -1222,7 +1222,7 @@ public List hmget(final byte[] key, final byte[]... fields) { * before applying the operation. Since the value argument is signed you can use this command to * perform both increments and decrements. *

- * The range of values supported by HINCRBY is limited to 64 bit signed integers. + * The range of values supported by HINCRBY is limited to 64-bit signed integers. *

* Time complexity: O(1) * @param key @@ -2646,7 +2646,7 @@ public KeyValue bzpopmin(final double timeout, final byte[]... ke * instructed to require a password before to allow clients to issue commands. This is done using * the requirepass directive in the Redis configuration file. If the password given by the connection * is correct the server replies with an OK status code reply and starts accepting commands from - * the connection. Otherwise an error is returned and the clients needs to try a new password. Note + * the connection. Otherwise, an error is returned and the clients needs to try a new password. Note * that for the high performance nature of Redis it is possible to try a lot of passwords in * parallel in very short time, so make sure to generate a strong and very long password so that * this attack is infeasible. @@ -3617,9 +3617,9 @@ public String configResetStat() { * *

* CONFIG REWRITE is also able to rewrite the configuration file from scratch if the original one - * no longer exists for some reason. However if the server was started without a configuration + * no longer exists for some reason. However, if the server was started without a configuration * file at all, the CONFIG REWRITE will just return an error. - * @return OK when the configuration was rewritten properly. Otherwise an error is returned. + * @return OK when the configuration was rewritten properly. Otherwise, an error is returned. */ @Override public String configRewrite() { @@ -4646,13 +4646,13 @@ public long hstrlen(final byte[] key, final byte[] field) { } @Override - public List xread(XReadParams xReadParams, Entry... streams) { + public List xread(XReadParams xReadParams, Entry... streams) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.xread(xReadParams, streams)); } @Override - public List xreadGroup(byte[] groupName, byte[] consumer, + public List xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Entry... streams) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); @@ -4671,25 +4671,25 @@ public long xlen(byte[] key) { } @Override - public List xrange(byte[] key, byte[] start, byte[] end) { + public List xrange(byte[] key, byte[] start, byte[] end) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.xrange(key, start, end)); } @Override - public List xrange(byte[] key, byte[] start, byte[] end, int count) { + public List xrange(byte[] key, byte[] start, byte[] end, int count) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.xrange(key, start, end, count)); } @Override - public List xrevrange(byte[] key, byte[] end, byte[] start) { + public List xrevrange(byte[] key, byte[] end, byte[] start) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.xrevrange(key, end, start)); } @Override - public List xrevrange(byte[] key, byte[] end, byte[] start, int count) { + public List xrevrange(byte[] key, byte[] end, byte[] start, int count) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.xrevrange(key, end, start, count)); } @@ -5002,7 +5002,7 @@ public long del(final String key) { /** * This command is very similar to DEL: it removes the specified keys. Just like DEL a key is - * ignored if it does not exist. However the command performs the actual memory reclaiming in a + * ignored if it does not exist. However, the command performs the actual memory reclaiming in a * different thread, so it is not blocking, while DEL is. This is where the command name comes * from: the command just unlinks the keys from the keyspace. The actual removal will happen later * asynchronously. @@ -5362,7 +5362,7 @@ public String setex(final String key, final long seconds, final String value) { } /** - * Set the the respective keys to the respective values. MSET will replace old values with new + * Set the respective keys to the respective values. MSET will replace old values with new * values, while {@link Jedis#msetnx(String...) MSETNX} will not perform any operation at all even * if just a single key already exists. *

@@ -5384,7 +5384,7 @@ public String mset(final String... keysvalues) { } /** - * Set the the respective keys to the respective values. {@link Jedis#mset(String...) MSET} will + * Set the respective keys to the respective values. {@link Jedis#mset(String...) MSET} will * replace old values with new values, while MSETNX will not perform any operation at all even if * just a single key already exists. *

@@ -5409,10 +5409,10 @@ public long msetnx(final String... keysvalues) { * IDECRBY work just like {@link Jedis#decr(String) INCR} but instead to decrement by 1 the * decrement is integer. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -5433,10 +5433,10 @@ public long decrBy(final String key, final long decrement) { * Decrement the number stored at key by one. If the key does not exist or contains a value of a * wrong type, set the key to the value of "0" before to perform the decrement operation. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -5456,10 +5456,10 @@ public long decr(final String key) { * INCRBY work just like {@link Jedis#incr(String) INCR} but instead to increment by 1 the * increment is integer. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -5501,10 +5501,10 @@ public double incrByFloat(final String key, final double increment) { * Increment the number stored at key by one. If the key does not exist or contains a value of a * wrong type, set the key to the value of "0" before to perform the increment operation. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -5654,7 +5654,7 @@ public List hmget(final String key, final String... fields) { * before applying the operation. Since the value argument is signed you can use this command to * perform both increments and decrements. *

- * The range of values supported by HINCRBY is limited to 64 bit signed integers. + * The range of values supported by HINCRBY is limited to 64-bit signed integers. *

* Time complexity: O(1) * @param key @@ -6386,7 +6386,7 @@ public String srandmember(final String key) { * @param key * @param count if positive, return an array of distinct elements. * If negative the behavior changes and the command is allowed to - * return the same element multiple times + * return the same element multiple times * @return A list of randomly selected elements */ @Override @@ -8758,7 +8758,7 @@ public long clusterKeySlot(final String key) { public long clusterCountFailureReports(final String nodeId) { checkIsInMultiOrPipeline(); connection.sendCommand(CLUSTER, "COUNT-FAILURE-REPORTS", nodeId); - return connection.getIntegerReply(); + return connection.getIntegerReply(); } @Override @@ -8826,12 +8826,20 @@ public String clusterFailover(ClusterFailoverOption failoverOption) { } @Override + @Deprecated public List clusterSlots() { checkIsInMultiOrPipeline(); connection.sendCommand(CLUSTER, ClusterKeyword.SLOTS); return connection.getObjectMultiBulkReply(); } + @Override + public List clusterShards() { + checkIsInMultiOrPipeline(); + connection.sendCommand(CLUSTER, ClusterKeyword.SHARDS); + return BuilderFactory.CLUSTER_SHARD_INFO_LIST.build(connection.getObjectMultiBulkReply()); + } + @Override public String clusterMyId() { checkIsInMultiOrPipeline(); @@ -9259,6 +9267,12 @@ public String lolwut(LolwutParams lolwutParams) { return connection.getBulkReply(); } + @Override + public String reset() { + connection.sendCommand(Command.RESET); + return connection.getStatusCodeReply(); + } + @Override public String latencyDoctor() { checkIsInMultiOrPipeline(); diff --git a/src/main/java/redis/clients/jedis/JedisClientConfig.java b/src/main/java/redis/clients/jedis/JedisClientConfig.java index beb0eabba6..0ad6e979f6 100644 --- a/src/main/java/redis/clients/jedis/JedisClientConfig.java +++ b/src/main/java/redis/clients/jedis/JedisClientConfig.java @@ -80,4 +80,11 @@ default HostAndPortMapper getHostAndPortMapper() { return null; } + /** + * Modify the behavior of internally executing CLIENT SETINFO command. + * @return CLIENT SETINFO config + */ + default ClientSetInfoConfig getClientSetInfoConfig() { + return ClientSetInfoConfig.DEFAULT; + } } diff --git a/src/main/java/redis/clients/jedis/JedisCluster.java b/src/main/java/redis/clients/jedis/JedisCluster.java index e9bb606191..4a73df3d07 100644 --- a/src/main/java/redis/clients/jedis/JedisCluster.java +++ b/src/main/java/redis/clients/jedis/JedisCluster.java @@ -12,6 +12,8 @@ public class JedisCluster extends UnifiedJedis { + public static final String INIT_NO_ERROR_PROPERTY = "jedis.cluster.initNoError"; + /** * Default timeout in milliseconds. */ @@ -195,6 +197,13 @@ public JedisCluster(Set clusterNodes, JedisClientConfig clientConfi super(clusterNodes, clientConfig, maxAttempts, maxTotalRetriesDuration); } + public JedisCluster(Set clusterNodes, JedisClientConfig clientConfig, + GenericObjectPoolConfig poolConfig, Duration topologyRefreshPeriod, int maxAttempts, + Duration maxTotalRetriesDuration) { + this(new ClusterConnectionProvider(clusterNodes, clientConfig, poolConfig, topologyRefreshPeriod), + maxAttempts, maxTotalRetriesDuration); + } + public JedisCluster(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) { super(provider, maxAttempts, maxTotalRetriesDuration); diff --git a/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java b/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java index a4cc2d1d63..bea4982fd4 100644 --- a/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java +++ b/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java @@ -1,5 +1,6 @@ package redis.clients.jedis; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -10,17 +11,26 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import redis.clients.jedis.exceptions.JedisClusterOperationException; import redis.clients.jedis.exceptions.JedisException; import redis.clients.jedis.util.SafeEncoder; +import static redis.clients.jedis.JedisCluster.INIT_NO_ERROR_PROPERTY; + public class JedisClusterInfoCache { + private static final Logger logger = LoggerFactory.getLogger(JedisClusterInfoCache.class); + private final Map nodes = new HashMap<>(); private final ConnectionPool[] slots = new ConnectionPool[Protocol.CLUSTER_HASHSLOTS]; private final HostAndPort[] slotNodes = new HostAndPort[Protocol.CLUSTER_HASHSLOTS]; @@ -36,21 +46,75 @@ public class JedisClusterInfoCache { private static final int MASTER_NODE_INDEX = 2; + /** + * The single thread executor for the topology refresh task. + */ + private ScheduledExecutorService topologyRefreshExecutor = null; + + class TopologyRefreshTask implements Runnable { + @Override + public void run() { + logger.debug("Cluster topology refresh run, old nodes: {}", nodes.keySet()); + renewClusterSlots(null); + logger.debug("Cluster topology refresh run, new nodes: {}", nodes.keySet()); + } + } + public JedisClusterInfoCache(final JedisClientConfig clientConfig, final Set startNodes) { this(clientConfig, null, startNodes); } public JedisClusterInfoCache(final JedisClientConfig clientConfig, final GenericObjectPoolConfig poolConfig, final Set startNodes) { + this(clientConfig, poolConfig, startNodes, null); + } + + public JedisClusterInfoCache(final JedisClientConfig clientConfig, + final GenericObjectPoolConfig poolConfig, final Set startNodes, + final Duration topologyRefreshPeriod) { this.poolConfig = poolConfig; this.clientConfig = clientConfig; this.startNodes = startNodes; + if (topologyRefreshPeriod != null) { + logger.info("Cluster topology refresh start, period: {}, startNodes: {}", topologyRefreshPeriod, startNodes); + topologyRefreshExecutor = Executors.newSingleThreadScheduledExecutor(); + topologyRefreshExecutor.scheduleWithFixedDelay(new TopologyRefreshTask(), topologyRefreshPeriod.toMillis(), + topologyRefreshPeriod.toMillis(), TimeUnit.MILLISECONDS); + } + } + + /** + * Check whether the number and order of slots in the cluster topology are equal to CLUSTER_HASHSLOTS + * @param slotsInfo the cluster topology + * @return if slots is ok, return true, elese return false. + */ + private boolean checkClusterSlotSequence(List slotsInfo) { + List slots = new ArrayList<>(); + for (Object slotInfoObj : slotsInfo) { + List slotInfo = (List)slotInfoObj; + slots.addAll(getAssignedSlotArray(slotInfo)); + } + Collections.sort(slots); + if (slots.size() != Protocol.CLUSTER_HASHSLOTS) { + return false; + } + for (int i = 0; i < Protocol.CLUSTER_HASHSLOTS; ++i) { + if (i != slots.get(i)) { + return false; + } + } + return true; } public void discoverClusterNodesAndSlots(Connection jedis) { List slotsInfo = executeClusterSlots(jedis); - if (slotsInfo.isEmpty()) { - throw new JedisClusterOperationException("Cluster slots list is empty."); + if (System.getProperty(INIT_NO_ERROR_PROPERTY) == null) { + if (slotsInfo.isEmpty()) { + throw new JedisClusterOperationException("Cluster slots list is empty."); + } + if (!checkClusterSlotSequence(slotsInfo)) { + throw new JedisClusterOperationException("Cluster slots have holes."); + } } w.lock(); try { @@ -133,8 +197,13 @@ public void renewClusterSlots(Connection jedis) { private void discoverClusterSlots(Connection jedis) { List slotsInfo = executeClusterSlots(jedis); - if (slotsInfo.isEmpty()) { - throw new JedisClusterOperationException("Cluster slots list is empty."); + if (System.getProperty(INIT_NO_ERROR_PROPERTY) == null) { + if (slotsInfo.isEmpty()) { + throw new JedisClusterOperationException("Cluster slots list is empty."); + } + if (!checkClusterSlotSequence(slotsInfo)) { + throw new JedisClusterOperationException("Cluster slots have holes."); + } } w.lock(); try { @@ -308,6 +377,14 @@ public void reset() { } } + public void close() { + reset(); + if (topologyRefreshExecutor != null) { + logger.info("Cluster topology refresh shutdown, startNodes: {}", startNodes); + topologyRefreshExecutor.shutdownNow(); + } + } + public static String getNodeKey(HostAndPort hnp) { //return hnp.getHost() + ":" + hnp.getPort(); return hnp.toString(); diff --git a/src/main/java/redis/clients/jedis/JedisMetaInfo.java b/src/main/java/redis/clients/jedis/JedisMetaInfo.java new file mode 100644 index 0000000000..04470de70a --- /dev/null +++ b/src/main/java/redis/clients/jedis/JedisMetaInfo.java @@ -0,0 +1,42 @@ +package redis.clients.jedis; + +import java.io.InputStream; +import java.util.Properties; +import org.slf4j.LoggerFactory; + +/** + * Jedis Meta info load version groupId + */ +class JedisMetaInfo { + + private static final String groupId; + private static final String artifactId; + private static final String version; + + static { + Properties p = new Properties(); + try (InputStream in = JedisMetaInfo.class.getClassLoader() + .getResourceAsStream("redis/clients/jedis/pom.properties")) { + p.load(in); + } catch (Exception e) { + LoggerFactory.getLogger(JedisMetaInfo.class) + .error("Load Jedis meta info from pom.properties failed", e); + } + + groupId = p.getProperty("groupId", null); + artifactId = p.getProperty("artifactId", null); + version = p.getProperty("version", null); + } + + public static String getGroupId() { + return groupId; + } + + public static String getArtifactId() { + return artifactId; + } + + public static String getVersion() { + return version; + } +} diff --git a/src/main/java/redis/clients/jedis/JedisSentinelPool.java b/src/main/java/redis/clients/jedis/JedisSentinelPool.java index 6f921ddd97..586750540c 100644 --- a/src/main/java/redis/clients/jedis/JedisSentinelPool.java +++ b/src/main/java/redis/clients/jedis/JedisSentinelPool.java @@ -31,8 +31,8 @@ public class JedisSentinelPool extends Pool { private final Object initPoolLock = new Object(); public JedisSentinelPool(String masterName, Set sentinels, - final JedisClientConfig masteClientConfig, final JedisClientConfig sentinelClientConfig) { - this(masterName, sentinels, new JedisFactory(masteClientConfig), sentinelClientConfig); + final JedisClientConfig masterClientConfig, final JedisClientConfig sentinelClientConfig) { + this(masterName, sentinels, new JedisFactory(masterClientConfig), sentinelClientConfig); } public JedisSentinelPool(String masterName, Set sentinels, @@ -167,9 +167,9 @@ public JedisSentinelPool(String masterName, Set sentinels, } public JedisSentinelPool(String masterName, Set sentinels, - final GenericObjectPoolConfig poolConfig, final JedisClientConfig masteClientConfig, + final GenericObjectPoolConfig poolConfig, final JedisClientConfig masterClientConfig, final JedisClientConfig sentinelClientConfig) { - this(masterName, sentinels, poolConfig, new JedisFactory(masteClientConfig), sentinelClientConfig); + this(masterName, sentinels, poolConfig, new JedisFactory(masterClientConfig), sentinelClientConfig); } public JedisSentinelPool(String masterName, Set sentinels, diff --git a/src/main/java/redis/clients/jedis/JedisSentineled.java b/src/main/java/redis/clients/jedis/JedisSentineled.java index 7a6c0cc5c0..063d1c40d9 100644 --- a/src/main/java/redis/clients/jedis/JedisSentineled.java +++ b/src/main/java/redis/clients/jedis/JedisSentineled.java @@ -24,4 +24,9 @@ public JedisSentineled(SentineledConnectionProvider sentineledConnectionProvider public HostAndPort getCurrentMaster() { return ((SentineledConnectionProvider) provider).getCurrentMaster(); } + + @Override + public Pipeline pipelined() { + return (Pipeline) super.pipelined(); + } } diff --git a/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java b/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java index eef6b2a810..a01ff4d1bb 100644 --- a/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java +++ b/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java @@ -1,6 +1,5 @@ package redis.clients.jedis; -import java.io.Closeable; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -14,16 +13,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import redis.clients.jedis.commands.PipelineBinaryCommands; -import redis.clients.jedis.commands.PipelineCommands; -import redis.clients.jedis.commands.RedisModulePipelineCommands; import redis.clients.jedis.exceptions.JedisConnectionException; import redis.clients.jedis.graph.GraphCommandObjects; import redis.clients.jedis.providers.ConnectionProvider; import redis.clients.jedis.util.IOUtils; -public abstract class MultiNodePipelineBase extends PipelineBase - implements PipelineCommands, PipelineBinaryCommands, RedisModulePipelineCommands, Closeable { +public abstract class MultiNodePipelineBase extends PipelineBase { private final Logger log = LoggerFactory.getLogger(getClass()); diff --git a/src/main/java/redis/clients/jedis/Pipeline.java b/src/main/java/redis/clients/jedis/Pipeline.java index 67e3523702..36fab65602 100644 --- a/src/main/java/redis/clients/jedis/Pipeline.java +++ b/src/main/java/redis/clients/jedis/Pipeline.java @@ -7,16 +7,12 @@ import java.util.Queue; import redis.clients.jedis.commands.DatabasePipelineCommands; -import redis.clients.jedis.commands.PipelineBinaryCommands; -import redis.clients.jedis.commands.PipelineCommands; -import redis.clients.jedis.commands.RedisModulePipelineCommands; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.graph.GraphCommandObjects; import redis.clients.jedis.params.*; import redis.clients.jedis.util.KeyValue; -public class Pipeline extends PipelineBase implements PipelineCommands, PipelineBinaryCommands, - DatabasePipelineCommands, RedisModulePipelineCommands, Closeable { +public class Pipeline extends PipelineBase implements DatabasePipelineCommands, Closeable { private final Queue> pipelinedResponses = new LinkedList<>(); protected final Connection connection; @@ -66,8 +62,8 @@ public void close() { public void sync() { if (!hasPipelinedResponse()) return; List unformatted = connection.getMany(pipelinedResponses.size()); - for (Object o : unformatted) { - pipelinedResponses.poll().set(o); + for (Object rawReply : unformatted) { + pipelinedResponses.poll().set(rawReply); } } @@ -81,10 +77,10 @@ public List syncAndReturnAll() { if (hasPipelinedResponse()) { List unformatted = connection.getMany(pipelinedResponses.size()); List formatted = new ArrayList<>(); - for (Object o : unformatted) { + for (Object rawReply : unformatted) { try { Response response = pipelinedResponses.poll(); - response.set(o); + response.set(rawReply); formatted.add(response.get()); } catch (JedisDataException e) { formatted.add(e); diff --git a/src/main/java/redis/clients/jedis/PipelineBase.java b/src/main/java/redis/clients/jedis/PipelineBase.java index f7ebe3eb50..2f4d246929 100644 --- a/src/main/java/redis/clients/jedis/PipelineBase.java +++ b/src/main/java/redis/clients/jedis/PipelineBase.java @@ -1,4227 +1,12 @@ package redis.clients.jedis; -import java.io.Closeable; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.json.JSONArray; - -import redis.clients.jedis.args.*; -import redis.clients.jedis.bloom.*; -import redis.clients.jedis.commands.PipelineBinaryCommands; -import redis.clients.jedis.commands.PipelineCommands; -import redis.clients.jedis.commands.ProtocolCommand; -import redis.clients.jedis.commands.RedisModulePipelineCommands; -import redis.clients.jedis.graph.GraphCommandObjects; -import redis.clients.jedis.graph.ResultSet; -import redis.clients.jedis.json.JsonSetParams; -import redis.clients.jedis.json.Path; -import redis.clients.jedis.json.Path2; -import redis.clients.jedis.json.JsonObjectMapper; -import redis.clients.jedis.params.*; -import redis.clients.jedis.resps.*; -import redis.clients.jedis.search.*; -import redis.clients.jedis.search.aggr.AggregationBuilder; -import redis.clients.jedis.search.aggr.AggregationResult; -import redis.clients.jedis.search.schemafields.SchemaField; -import redis.clients.jedis.timeseries.*; -import redis.clients.jedis.util.KeyValue; - -public abstract class PipelineBase implements PipelineCommands, PipelineBinaryCommands, - RedisModulePipelineCommands, Closeable { - - protected final CommandObjects commandObjects; - private GraphCommandObjects graphCommandObjects; - - public PipelineBase(CommandObjects commandObjects) { - this.commandObjects = commandObjects; - } - - /** - * Sub-classes must call this method, if graph commands are going to be used. - */ - protected final void setGraphCommands(GraphCommandObjects graphCommandObjects) { - this.graphCommandObjects = graphCommandObjects; - } - - protected abstract Response appendCommand(CommandObject commandObject); - - @Override - public abstract void close(); - - /** - * Synchronize pipeline by reading all responses. - */ - public abstract void sync(); - - @Override - public Response exists(String key) { - return appendCommand(commandObjects.exists(key)); - } - - @Override - public Response exists(String... keys) { - return appendCommand(commandObjects.exists(keys)); - } - - @Override - public Response persist(String key) { - return appendCommand(commandObjects.persist(key)); - } - - @Override - public Response type(String key) { - return appendCommand(commandObjects.type(key)); - } - - @Override - public Response dump(String key) { - return appendCommand(commandObjects.dump(key)); - } - - @Override - public Response restore(String key, long ttl, byte[] serializedValue) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue)); - } - - @Override - public Response restore(String key, long ttl, byte[] serializedValue, RestoreParams params) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue, params)); - } - - @Override - public Response expire(String key, long seconds) { - return appendCommand(commandObjects.expire(key, seconds)); - } - - @Override - public Response expire(String key, long seconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expire(key, seconds, expiryOption)); - } - - @Override - public Response pexpire(String key, long milliseconds) { - return appendCommand(commandObjects.pexpire(key, milliseconds)); - } - - @Override - public Response pexpire(String key, long milliseconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpire(key, milliseconds, expiryOption)); - } - - @Override - public Response expireTime(String key) { - return appendCommand(commandObjects.expireTime(key)); - } - - @Override - public Response pexpireTime(String key) { - return appendCommand(commandObjects.pexpireTime(key)); - } - - @Override - public Response expireAt(String key, long unixTime) { - return appendCommand(commandObjects.expireAt(key, unixTime)); - } - - @Override - public Response expireAt(String key, long unixTime, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expireAt(key, unixTime, expiryOption)); - } - - @Override - public Response pexpireAt(String key, long millisecondsTimestamp) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp)); - } - - @Override - public Response pexpireAt(String key, long millisecondsTimestamp, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp, expiryOption)); - } - - @Override - public Response ttl(String key) { - return appendCommand(commandObjects.ttl(key)); - } - - @Override - public Response pttl(String key) { - return appendCommand(commandObjects.pttl(key)); - } - - @Override - public Response touch(String key) { - return appendCommand(commandObjects.touch(key)); - } - - @Override - public Response touch(String... keys) { - return appendCommand(commandObjects.touch(keys)); - } - - @Override - public Response> sort(String key) { - return appendCommand(commandObjects.sort(key)); - } - - @Override - public Response sort(String key, String dstKey) { - return appendCommand(commandObjects.sort(key, dstKey)); - } - - @Override - public Response> sort(String key, SortingParams sortingParams) { - return appendCommand(commandObjects.sort(key, sortingParams)); - } - - @Override - public Response sort(String key, SortingParams sortingParams, String dstKey) { - return appendCommand(commandObjects.sort(key, sortingParams, dstKey)); - } - - @Override - public Response> sortReadonly(String key, SortingParams sortingParams) { - return appendCommand(commandObjects.sortReadonly(key, sortingParams)); - } - - @Override - public Response del(String key) { - return appendCommand(commandObjects.del(key)); - } - - @Override - public Response del(String... keys) { - return appendCommand(commandObjects.del(keys)); - } - - @Override - public Response unlink(String key) { - return appendCommand(commandObjects.unlink(key)); - } - - @Override - public Response unlink(String... keys) { - return appendCommand(commandObjects.unlink(keys)); - } - - @Override - public Response copy(String srcKey, String dstKey, boolean replace) { - return appendCommand(commandObjects.copy(srcKey, dstKey, replace)); - } - - @Override - public Response rename(String oldkey, String newkey) { - return appendCommand(commandObjects.rename(oldkey, newkey)); - } - - @Override - public Response renamenx(String oldkey, String newkey) { - return appendCommand(commandObjects.renamenx(oldkey, newkey)); - } - - @Override - public Response memoryUsage(String key) { - return appendCommand(commandObjects.memoryUsage(key)); - } - - @Override - public Response memoryUsage(String key, int samples) { - return appendCommand(commandObjects.memoryUsage(key, samples)); - } - - @Override - public Response objectRefcount(String key) { - return appendCommand(commandObjects.objectRefcount(key)); - } - - @Override - public Response objectEncoding(String key) { - return appendCommand(commandObjects.objectEncoding(key)); - } - - @Override - public Response objectIdletime(String key) { - return appendCommand(commandObjects.objectIdletime(key)); - } - - @Override - public Response objectFreq(String key) { - return appendCommand(commandObjects.objectFreq(key)); - } - - @Override - public Response migrate(String host, int port, String key, int timeout) { - return appendCommand(commandObjects.migrate(host, port, key, timeout)); - } - - @Override - public Response migrate(String host, int port, int timeout, MigrateParams params, String... keys) { - return appendCommand(commandObjects.migrate(host, port, timeout, params, keys)); - } - - @Override - public Response> keys(String pattern) { - return appendCommand(commandObjects.keys(pattern)); - } - - @Override - public Response> scan(String cursor) { - return appendCommand(commandObjects.scan(cursor)); - } - - @Override - public Response> scan(String cursor, ScanParams params) { - return appendCommand(commandObjects.scan(cursor, params)); - } - - @Override - public Response> scan(String cursor, ScanParams params, String type) { - return appendCommand(commandObjects.scan(cursor, params, type)); - } - - @Override - public Response randomKey() { - return appendCommand(commandObjects.randomKey()); - } - - @Override - public Response get(String key) { - return appendCommand(commandObjects.get(key)); - } - - @Override - public Response setGet(String key, String value, SetParams params) { - return appendCommand(commandObjects.setGet(key, value, params)); - } - - @Override - public Response getDel(String key) { - return appendCommand(commandObjects.getDel(key)); - } - - @Override - public Response getEx(String key, GetExParams params) { - return appendCommand(commandObjects.getEx(key, params)); - } - - @Override - public Response setbit(String key, long offset, boolean value) { - return appendCommand(commandObjects.setbit(key, offset, value)); - } - - @Override - public Response getbit(String key, long offset) { - return appendCommand(commandObjects.getbit(key, offset)); - } - - @Override - public Response setrange(String key, long offset, String value) { - return appendCommand(commandObjects.setrange(key, offset, value)); - } - - @Override - public Response getrange(String key, long startOffset, long endOffset) { - return appendCommand(commandObjects.getrange(key, startOffset, endOffset)); - } - - @Override - public Response getSet(String key, String value) { - return appendCommand(commandObjects.getSet(key, value)); - } - - @Override - public Response setnx(String key, String value) { - return appendCommand(commandObjects.setnx(key, value)); - } - - @Override - public Response setex(String key, long seconds, String value) { - return appendCommand(commandObjects.setex(key, seconds, value)); - } - - @Override - public Response psetex(String key, long milliseconds, String value) { - return appendCommand(commandObjects.psetex(key, milliseconds, value)); - } - - @Override - public Response> mget(String... keys) { - return appendCommand(commandObjects.mget(keys)); - } - - @Override - public Response mset(String... keysvalues) { - return appendCommand(commandObjects.mset(keysvalues)); - } - - @Override - public Response msetnx(String... keysvalues) { - return appendCommand(commandObjects.msetnx(keysvalues)); - } - - @Override - public Response incr(String key) { - return appendCommand(commandObjects.incr(key)); - } - - @Override - public Response incrBy(String key, long increment) { - return appendCommand(commandObjects.incrBy(key, increment)); - } - - @Override - public Response incrByFloat(String key, double increment) { - return appendCommand(commandObjects.incrByFloat(key, increment)); - } - - @Override - public Response decr(String key) { - return appendCommand(commandObjects.decr(key)); - } - - @Override - public Response decrBy(String key, long decrement) { - return appendCommand(commandObjects.decrBy(key, decrement)); - } - - @Override - public Response append(String key, String value) { - return appendCommand(commandObjects.append(key, value)); - } - - @Override - public Response substr(String key, int start, int end) { - return appendCommand(commandObjects.substr(key, start, end)); - } - - @Override - public Response strlen(String key) { - return appendCommand(commandObjects.strlen(key)); - } - - @Override - public Response bitcount(String key) { - return appendCommand(commandObjects.bitcount(key)); - } - - @Override - public Response bitcount(String key, long start, long end) { - return appendCommand(commandObjects.bitcount(key, start, end)); - } - - @Override - public Response bitcount(String key, long start, long end, BitCountOption option) { - return appendCommand(commandObjects.bitcount(key, start, end, option)); - } - - @Override - public Response bitpos(String key, boolean value) { - return appendCommand(commandObjects.bitpos(key, value)); - } - - @Override - public Response bitpos(String key, boolean value, BitPosParams params) { - return appendCommand(commandObjects.bitpos(key, value, params)); - } - - @Override - public Response> bitfield(String key, String... arguments) { - return appendCommand(commandObjects.bitfield(key, arguments)); - } - - @Override - public Response> bitfieldReadonly(String key, String... arguments) { - return appendCommand(commandObjects.bitfieldReadonly(key, arguments)); - } - - @Override - public Response bitop(BitOP op, String destKey, String... srcKeys) { - return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); - } - - @Override - public Response lcs(String keyA, String keyB, LCSParams params) { - return appendCommand(commandObjects.lcs(keyA, keyB, params)); - } - - @Override - public Response set(String key, String value) { - return appendCommand(commandObjects.set(key, value)); - } - - @Override - public Response set(String key, String value, SetParams params) { - return appendCommand(commandObjects.set(key, value, params)); - } - - @Override - public Response rpush(String key, String... string) { - return appendCommand(commandObjects.rpush(key, string)); - - } - - @Override - public Response lpush(String key, String... string) { - return appendCommand(commandObjects.lpush(key, string)); - } - - @Override - public Response llen(String key) { - return appendCommand(commandObjects.llen(key)); - } - - @Override - public Response> lrange(String key, long start, long stop) { - return appendCommand(commandObjects.lrange(key, start, stop)); - } - - @Override - public Response ltrim(String key, long start, long stop) { - return appendCommand(commandObjects.ltrim(key, start, stop)); - } - - @Override - public Response lindex(String key, long index) { - return appendCommand(commandObjects.lindex(key, index)); - } - - @Override - public Response lset(String key, long index, String value) { - return appendCommand(commandObjects.lset(key, index, value)); - } - - @Override - public Response lrem(String key, long count, String value) { - return appendCommand(commandObjects.lrem(key, count, value)); - } - - @Override - public Response lpop(String key) { - return appendCommand(commandObjects.lpop(key)); - } - - @Override - public Response> lpop(String key, int count) { - return appendCommand(commandObjects.lpop(key, count)); - } - - @Override - public Response lpos(String key, String element) { - return appendCommand(commandObjects.lpos(key, element)); - } - - @Override - public Response lpos(String key, String element, LPosParams params) { - return appendCommand(commandObjects.lpos(key, element, params)); - } - - @Override - public Response> lpos(String key, String element, LPosParams params, long count) { - return appendCommand(commandObjects.lpos(key, element, params, count)); - } - - @Override - public Response rpop(String key) { - return appendCommand(commandObjects.rpop(key)); - } - - @Override - public Response> rpop(String key, int count) { - return appendCommand(commandObjects.rpop(key, count)); - } - - @Override - public Response linsert(String key, ListPosition where, String pivot, String value) { - return appendCommand(commandObjects.linsert(key, where, pivot, value)); - } - - @Override - public Response lpushx(String key, String... strings) { - return appendCommand(commandObjects.lpushx(key, strings)); - } - - @Override - public Response rpushx(String key, String... strings) { - return appendCommand(commandObjects.rpushx(key, strings)); - } - - @Override - public Response> blpop(int timeout, String key) { - return appendCommand(commandObjects.blpop(timeout, key)); - } - - @Override - public Response> blpop(double timeout, String key) { - return appendCommand(commandObjects.blpop(timeout, key)); - } - - @Override - public Response> brpop(int timeout, String key) { - return appendCommand(commandObjects.brpop(timeout, key)); - } - - @Override - public Response> brpop(double timeout, String key) { - return appendCommand(commandObjects.brpop(timeout, key)); - } - - @Override - public Response> blpop(int timeout, String... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> blpop(double timeout, String... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> brpop(int timeout, String... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response> brpop(double timeout, String... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response rpoplpush(String srcKey, String dstKey) { - return appendCommand(commandObjects.rpoplpush(srcKey, dstKey)); - } - - @Override - public Response brpoplpush(String source, String destination, int timeout) { - return appendCommand(commandObjects.brpoplpush(source, destination, timeout)); - } - - @Override - public Response lmove(String srcKey, String dstKey, ListDirection from, ListDirection to) { - return appendCommand(commandObjects.lmove(srcKey, dstKey, from, to)); - } - - @Override - public Response blmove(String srcKey, String dstKey, ListDirection from, ListDirection to, double timeout) { - return appendCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); - } - - @Override - public Response>> lmpop(ListDirection direction, String... keys) { - return appendCommand(commandObjects.lmpop(direction, keys)); - } - - @Override - public Response>> lmpop(ListDirection direction, int count, String... keys) { - return appendCommand(commandObjects.lmpop(direction, count, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, String... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, int count, String... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); - } - - @Override - public Response hset(String key, String field, String value) { - return appendCommand(commandObjects.hset(key, field, value)); - } - - @Override - public Response hset(String key, Map hash) { - return appendCommand(commandObjects.hset(key, hash)); - } - - @Override - public Response hget(String key, String field) { - return appendCommand(commandObjects.hget(key, field)); - } - - @Override - public Response hsetnx(String key, String field, String value) { - return appendCommand(commandObjects.hsetnx(key, field, value)); - } - - @Override - public Response hmset(String key, Map hash) { - return appendCommand(commandObjects.hmset(key, hash)); - } - - @Override - public Response> hmget(String key, String... fields) { - return appendCommand(commandObjects.hmget(key, fields)); - } - - @Override - public Response hincrBy(String key, String field, long value) { - return appendCommand(commandObjects.hincrBy(key, field, value)); - } - - @Override - public Response hincrByFloat(String key, String field, double value) { - return appendCommand(commandObjects.hincrByFloat(key, field, value)); - } - - @Override - public Response hexists(String key, String field) { - return appendCommand(commandObjects.hexists(key, field)); - } - - @Override - public Response hdel(String key, String... field) { - return appendCommand(commandObjects.hdel(key, field)); - } - - @Override - public Response hlen(String key) { - return appendCommand(commandObjects.hlen(key)); - } - - @Override - public Response> hkeys(String key) { - return appendCommand(commandObjects.hkeys(key)); - } - - @Override - public Response> hvals(String key) { - return appendCommand(commandObjects.hvals(key)); - } - - @Override - public Response> hgetAll(String key) { - return appendCommand(commandObjects.hgetAll(key)); - } - - @Override - public Response hrandfield(String key) { - return appendCommand(commandObjects.hrandfield(key)); - } - - @Override - public Response> hrandfield(String key, long count) { - return appendCommand(commandObjects.hrandfield(key, count)); - } - - @Override - public Response>> hrandfieldWithValues(String key, long count) { - return appendCommand(commandObjects.hrandfieldWithValues(key, count)); - } - - @Override - public Response>> hscan(String key, String cursor, ScanParams params) { - return appendCommand(commandObjects.hscan(key, cursor, params)); - } - - @Override - public Response hstrlen(String key, String field) { - return appendCommand(commandObjects.hstrlen(key, field)); - } - - @Override - public Response sadd(String key, String... members) { - return appendCommand(commandObjects.sadd(key, members)); - } - - @Override - public Response> smembers(String key) { - return appendCommand(commandObjects.smembers(key)); - } - - @Override - public Response srem(String key, String... members) { - return appendCommand(commandObjects.srem(key, members)); - } - - @Override - public Response spop(String key) { - return appendCommand(commandObjects.spop(key)); - } - - @Override - public Response> spop(String key, long count) { - return appendCommand(commandObjects.spop(key, count)); - } - - @Override - public Response scard(String key) { - return appendCommand(commandObjects.scard(key)); - } - - @Override - public Response sismember(String key, String member) { - return appendCommand(commandObjects.sismember(key, member)); - } - - @Override - public Response> smismember(String key, String... members) { - return appendCommand(commandObjects.smismember(key, members)); - } - - @Override - public Response srandmember(String key) { - return appendCommand(commandObjects.srandmember(key)); - } - - @Override - public Response> srandmember(String key, int count) { - return appendCommand(commandObjects.srandmember(key, count)); - } - - @Override - public Response> sscan(String key, String cursor, ScanParams params) { - return appendCommand(commandObjects.sscan(key, cursor, params)); - } - - @Override - public Response> sdiff(String... keys) { - return appendCommand(commandObjects.sdiff(keys)); - } - - @Override - public Response sdiffStore(String dstKey, String... keys) { - return appendCommand(commandObjects.sdiffstore(dstKey, keys)); - } - - @Override - public Response> sinter(String... keys) { - return appendCommand(commandObjects.sinter(keys)); - } - - @Override - public Response sinterstore(String dstKey, String... keys) { - return appendCommand(commandObjects.sinterstore(dstKey, keys)); - } - - @Override - public Response sintercard(String... keys) { - return appendCommand(commandObjects.sintercard(keys)); - } - - @Override - public Response sintercard(int limit, String... keys) { - return appendCommand(commandObjects.sintercard(limit, keys)); - } - - @Override - public Response> sunion(String... keys) { - return appendCommand(commandObjects.sunion(keys)); - } - - @Override - public Response sunionstore(String dstKey, String... keys) { - return appendCommand(commandObjects.sunionstore(dstKey, keys)); - } - - @Override - public Response smove(String srcKey, String dstKey, String member) { - return appendCommand(commandObjects.smove(srcKey, dstKey, member)); - } - - @Override - public Response zadd(String key, double score, String member) { - return appendCommand(commandObjects.zadd(key, score, member)); - } - - @Override - public Response zadd(String key, double score, String member, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, score, member, params)); - } - - @Override - public Response zadd(String key, Map scoreMembers) { - return appendCommand(commandObjects.zadd(key, scoreMembers)); - } - - @Override - public Response zadd(String key, Map scoreMembers, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, scoreMembers, params)); - } - - @Override - public Response zaddIncr(String key, double score, String member, ZAddParams params) { - return appendCommand(commandObjects.zaddIncr(key, score, member, params)); - } - - @Override - public Response zrem(String key, String... members) { - return appendCommand(commandObjects.zrem(key, members)); - } - - @Override - public Response zincrby(String key, double increment, String member) { - return appendCommand(commandObjects.zincrby(key, increment, member)); - } - - @Override - public Response zincrby(String key, double increment, String member, ZIncrByParams params) { - return appendCommand(commandObjects.zincrby(key, increment, member, params)); - } - - @Override - public Response zrank(String key, String member) { - return appendCommand(commandObjects.zrank(key, member)); - } - - @Override - public Response zrevrank(String key, String member) { - return appendCommand(commandObjects.zrevrank(key, member)); - } - - @Override - public Response> zrankWithScore(String key, String member) { - return appendCommand(commandObjects.zrankWithScore(key, member)); - } - - @Override - public Response> zrevrankWithScore(String key, String member) { - return appendCommand(commandObjects.zrevrankWithScore(key, member)); - } - - @Override - public Response> zrange(String key, long start, long stop) { - return appendCommand(commandObjects.zrange(key, start, stop)); - } - - @Override - public Response> zrevrange(String key, long start, long stop) { - return appendCommand(commandObjects.zrevrange(key, start, stop)); - } - - @Override - public Response> zrangeWithScores(String key, long start, long stop) { - return appendCommand(commandObjects.zrangeWithScores(key, start, stop)); - } - - @Override - public Response> zrevrangeWithScores(String key, long start, long stop) { - return appendCommand(commandObjects.zrevrangeWithScores(key, start, stop)); - } - - @Override - public Response zrandmember(String key) { - return appendCommand(commandObjects.zrandmember(key)); - } - - @Override - public Response> zrandmember(String key, long count) { - return appendCommand(commandObjects.zrandmember(key, count)); - } - - @Override - public Response> zrandmemberWithScores(String key, long count) { - return appendCommand(commandObjects.zrandmemberWithScores(key, count)); - } - - @Override - public Response zcard(String key) { - return appendCommand(commandObjects.zcard(key)); - } - - @Override - public Response zscore(String key, String member) { - return appendCommand(commandObjects.zscore(key, member)); - } - - @Override - public Response> zmscore(String key, String... members) { - return appendCommand(commandObjects.zmscore(key, members)); - } - - @Override - public Response zpopmax(String key) { - return appendCommand(commandObjects.zpopmax(key)); - } - - @Override - public Response> zpopmax(String key, int count) { - return appendCommand(commandObjects.zpopmax(key, count)); - } - - @Override - public Response zpopmin(String key) { - return appendCommand(commandObjects.zpopmin(key)); - } - - @Override - public Response> zpopmin(String key, int count) { - return appendCommand(commandObjects.zpopmin(key, count)); - } - - @Override - public Response zcount(String key, double min, double max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response zcount(String key, String min, String max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response> zrangeByScore(String key, double min, double max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrangeByScore(String key, String min, String max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrevrangeByScore(String key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - } - - @Override - public Response> zrangeByScore(String key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(String key, String max, String min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - } - - @Override - public Response> zrangeByScore(String key, String min, String max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(String key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, double min, double max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(String key, String max, String min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, String min, String max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, String max, String min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, String min, String max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response> zrange(String key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrange(key, zRangeParams)); - } - - @Override - public Response> zrangeWithScores(String key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangeWithScores(key, zRangeParams)); - } - - @Override - public Response zrangestore(String dest, String src, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangestore(dest, src, zRangeParams)); - } - - @Override - public Response zremrangeByRank(String key, long start, long stop) { - return appendCommand(commandObjects.zremrangeByRank(key, start, stop)); - } - - @Override - public Response zremrangeByScore(String key, double min, double max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zremrangeByScore(String key, String min, String max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zlexcount(String key, String min, String max) { - return appendCommand(commandObjects.zlexcount(key, min, max)); - } - - @Override - public Response> zrangeByLex(String key, String min, String max) { - return appendCommand(commandObjects.zrangeByLex(key, min, max)); - } - - @Override - public Response> zrangeByLex(String key, String min, String max, int offset, int count) { - return appendCommand(commandObjects.zrangeByLex(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByLex(String key, String max, String min) { - return appendCommand(commandObjects.zrevrangeByLex(key, max, min)); - } - - @Override - public Response> zrevrangeByLex(String key, String max, String min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByLex(key, max, min, offset, count)); - } - - @Override - public Response zremrangeByLex(String key, String min, String max) { - return appendCommand(commandObjects.zremrangeByLex(key, min, max)); - } - - @Override - public Response> zscan(String key, String cursor, ScanParams params) { - return appendCommand(commandObjects.zscan(key, cursor, params)); - } - - @Override - public Response> bzpopmax(double timeout, String... keys) { - return appendCommand(commandObjects.bzpopmax(timeout, keys)); - } - - @Override - public Response> bzpopmin(double timeout, String... keys) { - return appendCommand(commandObjects.bzpopmin(timeout, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, String... keys) { - return appendCommand(commandObjects.zmpop(option, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, int count, String... keys) { - return appendCommand(commandObjects.zmpop(option, count, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, String... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); - } - - @Override - public Response> zdiff(String... keys) { - return appendCommand(commandObjects.zdiff(keys)); - } - - @Override - public Response> zdiffWithScores(String... keys) { - return appendCommand(commandObjects.zdiffWithScores(keys)); - } - - @Override - @Deprecated - public Response zdiffStore(String dstKey, String... keys) { - return appendCommand(commandObjects.zdiffStore(dstKey, keys)); - } - - @Override - public Response zdiffstore(String dstKey, String... keys) { - return appendCommand(commandObjects.zdiffstore(dstKey, keys)); - } - - @Override - public Response zinterstore(String dstKey, String... sets) { - return appendCommand(commandObjects.zinterstore(dstKey, sets)); - } - - @Override - public Response zinterstore(String dstKey, ZParams params, String... sets) { - return appendCommand(commandObjects.zinterstore(dstKey, params, sets)); - } - - @Override - public Response> zinter(ZParams params, String... keys) { - return appendCommand(commandObjects.zinter(params, keys)); - } - - @Override - public Response> zinterWithScores(ZParams params, String... keys) { - return appendCommand(commandObjects.zinterWithScores(params, keys)); - } - - @Override - public Response zintercard(String... keys) { - return appendCommand(commandObjects.zintercard(keys)); - } - - @Override - public Response zintercard(long limit, String... keys) { - return appendCommand(commandObjects.zintercard(limit, keys)); - } - - @Override - public Response> zunion(ZParams params, String... keys) { - return appendCommand(commandObjects.zunion(params, keys)); - } - - @Override - public Response> zunionWithScores(ZParams params, String... keys) { - return appendCommand(commandObjects.zunionWithScores(params, keys)); - } - - @Override - public Response zunionstore(String dstKey, String... sets) { - return appendCommand(commandObjects.zunionstore(dstKey, sets)); - } - - @Override - public Response zunionstore(String dstKey, ZParams params, String... sets) { - return appendCommand(commandObjects.zunionstore(dstKey, params, sets)); - } - - @Override - public Response geoadd(String key, double longitude, double latitude, String member) { - return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); - } - - @Override - public Response geoadd(String key, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, memberCoordinateMap)); - } - - @Override - public Response geoadd(String key, GeoAddParams params, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); - } - - @Override - public Response geodist(String key, String member1, String member2) { - return appendCommand(commandObjects.geodist(key, member1, member2)); - } - - @Override - public Response geodist(String key, String member1, String member2, GeoUnit unit) { - return appendCommand(commandObjects.geodist(key, member1, member2, unit)); - } - - @Override - public Response> geohash(String key, String... members) { - return appendCommand(commandObjects.geohash(key, members)); - } - - @Override - public Response> geopos(String key, String... members) { - return appendCommand(commandObjects.geopos(key, members)); - } - - @Override - public Response> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusByMember(String key, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); - } - - @Override - public Response> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); - } - - @Override - public Response georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); - } - - @Override - public Response georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); - } - - @Override - public Response> geosearch(String key, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, radius, unit)); - } - - @Override - public Response> geosearch(String key, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, radius, unit)); - } - - @Override - public Response> geosearch(String key, String member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, width, height, unit)); - } - - @Override - public Response> geosearch(String key, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, width, height, unit)); - } - - @Override - public Response> geosearch(String key, GeoSearchParam params) { - return appendCommand(commandObjects.geosearch(key, params)); - } - - @Override - public Response geosearchStore(String dest, String src, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, radius, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, String member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStore(dest, src, params)); - } - - @Override - public Response geosearchStoreStoreDist(String dest, String src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStoreStoreDist(dest, src, params)); - } - - @Override - public Response pfadd(String key, String... elements) { - return appendCommand(commandObjects.pfadd(key, elements)); - } - - @Override - public Response pfmerge(String destkey, String... sourcekeys) { - return appendCommand(commandObjects.pfmerge(destkey, sourcekeys)); - } - - @Override - public Response pfcount(String key) { - return appendCommand(commandObjects.pfcount(key)); - } - - @Override - public Response pfcount(String... keys) { - return appendCommand(commandObjects.pfcount(keys)); - } - - @Override - public Response xadd(String key, StreamEntryID id, Map hash) { - return appendCommand(commandObjects.xadd(key, id, hash)); - } - - @Override - public Response xadd(String key, XAddParams params, Map hash) { - return appendCommand(commandObjects.xadd(key, params, hash)); - } - - @Override - public Response xlen(String key) { - return appendCommand(commandObjects.xlen(key)); - } - - @Override - public Response> xrange(String key, StreamEntryID start, StreamEntryID end) { - return appendCommand(commandObjects.xrange(key, start, end)); - } - - @Override - public Response> xrange(String key, StreamEntryID start, StreamEntryID end, int count) { - return appendCommand(commandObjects.xrange(key, start, end, count)); - } - - @Override - public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start) { - return appendCommand(commandObjects.xrevrange(key, end, start)); - } - - @Override - public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count) { - return appendCommand(commandObjects.xrevrange(key, end, start, count)); - } - - @Override - public Response> xrange(String key, String start, String end) { - return appendCommand(commandObjects.xrange(key, start, end)); - } - - @Override - public Response> xrange(String key, String start, String end, int count) { - return appendCommand(commandObjects.xrange(key, start, end, count)); - } - - @Override - public Response> xrevrange(String key, String end, String start) { - return appendCommand(commandObjects.xrevrange(key, end, start)); - } - - @Override - public Response> xrevrange(String key, String end, String start, int count) { - return appendCommand(commandObjects.xrevrange(key, end, start, count)); - } - - @Override - public Response xack(String key, String group, StreamEntryID... ids) { - return appendCommand(commandObjects.xack(key, group, ids)); - } - - @Override - public Response xgroupCreate(String key, String groupName, StreamEntryID id, boolean makeStream) { - return appendCommand(commandObjects.xgroupCreate(key, groupName, id, makeStream)); - } - - @Override - public Response xgroupSetID(String key, String groupName, StreamEntryID id) { - return appendCommand(commandObjects.xgroupSetID(key, groupName, id)); - } - - @Override - public Response xgroupDestroy(String key, String groupName) { - return appendCommand(commandObjects.xgroupDestroy(key, groupName)); - } - - @Override - public Response xgroupCreateConsumer(String key, String groupName, String consumerName) { - return appendCommand(commandObjects.xgroupCreateConsumer(key, groupName, consumerName)); - } - - @Override - public Response xgroupDelConsumer(String key, String groupName, String consumerName) { - return appendCommand(commandObjects.xgroupDelConsumer(key, groupName, consumerName)); - } - - @Override - public Response xpending(String key, String groupName) { - return appendCommand(commandObjects.xpending(key, groupName)); - } - - @Override - public Response> xpending(String key, String groupName, XPendingParams params) { - return appendCommand(commandObjects.xpending(key, groupName, params)); - } - - @Override - public Response xdel(String key, StreamEntryID... ids) { - return appendCommand(commandObjects.xdel(key, ids)); - } - - @Override - public Response xtrim(String key, long maxLen, boolean approximate) { - return appendCommand(commandObjects.xtrim(key, maxLen, approximate)); - } - - @Override - public Response xtrim(String key, XTrimParams params) { - return appendCommand(commandObjects.xtrim(key, params)); - } - - @Override - public Response> xclaim(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { - return appendCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response> xclaimJustId(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { - return appendCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response>> xautoclaim(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaim(key, group, consumerName, minIdleTime, start, params)); - } - - @Override - public Response>> xautoclaimJustId(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaimJustId(key, group, consumerName, minIdleTime, start, params)); - } - - @Override - public Response xinfoStream(String key) { - return appendCommand(commandObjects.xinfoStream(key)); - } - - @Override - public Response xinfoStreamFull(String key) { - return appendCommand(commandObjects.xinfoStreamFull(key)); - } - - @Override - public Response xinfoStreamFull(String key, int count) { - return appendCommand(commandObjects.xinfoStreamFull(key, count)); - } - - @Override - public Response> xinfoGroups(String key) { - return appendCommand(commandObjects.xinfoGroups(key)); - } - - @Override - public Response> xinfoConsumers(String key, String group) { - return appendCommand(commandObjects.xinfoConsumers(key, group)); - } - - @Override - public Response> xinfoConsumers2(String key, String group) { - return appendCommand(commandObjects.xinfoConsumers2(key, group)); - } - - @Override - public Response>>> xread(XReadParams xReadParams, Map streams) { - return appendCommand(commandObjects.xread(xReadParams, streams)); - } - - @Override - public Response>>> xreadGroup(String groupName, String consumer, XReadGroupParams xReadGroupParams, Map streams) { - return appendCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); - } - - @Override - public Response eval(String script) { - return appendCommand(commandObjects.eval(script)); - } - - @Override - public Response eval(String script, int keyCount, String... params) { - return appendCommand(commandObjects.eval(script, keyCount, params)); - } - - @Override - public Response eval(String script, List keys, List args) { - return appendCommand(commandObjects.eval(script, keys, args)); - } - - @Override - public Response evalReadonly(String script, List keys, List args) { - return appendCommand(commandObjects.evalReadonly(script, keys, args)); - } - - @Override - public Response evalsha(String sha1) { - return appendCommand(commandObjects.evalsha(sha1)); - } - - @Override - public Response evalsha(String sha1, int keyCount, String... params) { - return appendCommand(commandObjects.evalsha(sha1, keyCount, params)); - } - - @Override - public Response evalsha(String sha1, List keys, List args) { - return appendCommand(commandObjects.evalsha(sha1, keys, args)); - } - - @Override - public Response evalshaReadonly(String sha1, List keys, List args) { - return appendCommand(commandObjects.evalshaReadonly(sha1, keys, args)); - } - - @Override - public Response waitReplicas(String sampleKey, int replicas, long timeout) { - return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); - } - - @Override - public Response> waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) { - return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); - } - - @Override - public Response eval(String script, String sampleKey) { - return appendCommand(commandObjects.eval(script, sampleKey)); - } - - @Override - public Response evalsha(String sha1, String sampleKey) { - return appendCommand(commandObjects.evalsha(sha1, sampleKey)); - } - - @Override - public Response> scriptExists(String sampleKey, String... sha1) { - return appendCommand(commandObjects.scriptExists(sampleKey, sha1)); - } - - @Override - public Response scriptLoad(String script, String sampleKey) { - return appendCommand(commandObjects.scriptLoad(script, sampleKey)); - } - - @Override - public Response scriptFlush(String sampleKey) { - return appendCommand(commandObjects.scriptFlush(sampleKey)); - } - - @Override - public Response scriptFlush(String sampleKey, FlushMode flushMode) { - return appendCommand(commandObjects.scriptFlush(sampleKey, flushMode)); - } - - @Override - public Response scriptKill(String sampleKey) { - return appendCommand(commandObjects.scriptKill(sampleKey)); - } - - @Override - public Response fcall(byte[] name, List keys, List args) { - return appendCommand(commandObjects.fcall(name, keys, args)); - } - - @Override - public Response fcall(String name, List keys, List args) { - return appendCommand(commandObjects.fcall(name, keys, args)); - } - - @Override - public Response fcallReadonly(byte[] name, List keys, List args) { - return appendCommand(commandObjects.fcallReadonly(name, keys, args)); - } - - @Override - public Response fcallReadonly(String name, List keys, List args) { - return appendCommand(commandObjects.fcallReadonly(name, keys, args)); - } - - @Override - public Response functionDelete(byte[] libraryName) { - return appendCommand(commandObjects.functionDelete(libraryName)); - } - - @Override - public Response functionDelete(String libraryName) { - return appendCommand(commandObjects.functionDelete(libraryName)); - } - - @Override - public Response functionDump() { - return appendCommand(commandObjects.functionDump()); - } - - @Override - public Response> functionList(String libraryNamePattern) { - return appendCommand(commandObjects.functionList(libraryNamePattern)); - } - - @Override - public Response> functionList() { - return appendCommand(commandObjects.functionList()); - } - - @Override - public Response> functionListWithCode(String libraryNamePattern) { - return appendCommand(commandObjects.functionListWithCode(libraryNamePattern)); - } - - @Override - public Response> functionListWithCode() { - return appendCommand(commandObjects.functionListWithCode()); - } - - @Override - public Response> functionListBinary() { - return appendCommand(commandObjects.functionListBinary()); - } - - @Override - public Response> functionList(final byte[] libraryNamePattern) { - return appendCommand(commandObjects.functionList(libraryNamePattern)); - } - - @Override - public Response> functionListWithCodeBinary() { - return appendCommand(commandObjects.functionListWithCodeBinary()); - } - - @Override - public Response> functionListWithCode(final byte[] libraryNamePattern) { - return appendCommand(commandObjects.functionListWithCode(libraryNamePattern)); - } - - @Override - public Response functionLoad(byte[] functionCode) { - return appendCommand(commandObjects.functionLoad(functionCode)); - } - - @Override - public Response functionLoad(String functionCode) { - return appendCommand(commandObjects.functionLoad(functionCode)); - } - - @Override - public Response functionLoadReplace(byte[] functionCode) { - return appendCommand(commandObjects.functionLoadReplace(functionCode)); - } - - @Override - public Response functionLoadReplace(String functionCode) { - return appendCommand(commandObjects.functionLoadReplace(functionCode)); - } - - @Override - public Response functionRestore(byte[] serializedValue) { - return appendCommand(commandObjects.functionRestore(serializedValue)); - } - - @Override - public Response functionRestore(byte[] serializedValue, FunctionRestorePolicy policy) { - return appendCommand(commandObjects.functionRestore(serializedValue, policy)); - } - - @Override - public Response functionFlush() { - return appendCommand(commandObjects.functionFlush()); - } - - @Override - public Response functionFlush(FlushMode mode) { - return appendCommand(commandObjects.functionFlush(mode)); - } - - @Override - public Response functionKill() { - return appendCommand(commandObjects.functionKill()); - } - - @Override - public Response functionStats() { - return appendCommand(commandObjects.functionStats()); - } - - @Override - public Response functionStatsBinary() { - return appendCommand(commandObjects.functionStatsBinary()); - } - - @Override - public Response geoadd(byte[] key, double longitude, double latitude, byte[] member) { - return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); - } - - @Override - public Response geoadd(byte[] key, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, memberCoordinateMap)); - } - - @Override - public Response geoadd(byte[] key, GeoAddParams params, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); - } - - @Override - public Response geodist(byte[] key, byte[] member1, byte[] member2) { - return appendCommand(commandObjects.geodist(key, member1, member2)); - } - - @Override - public Response geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit) { - return appendCommand(commandObjects.geodist(key, member1, member2, unit)); - } - - @Override - public Response> geohash(byte[] key, byte[]... members) { - return appendCommand(commandObjects.geohash(key, members)); - } - - @Override - public Response> geopos(byte[] key, byte[]... members) { - return appendCommand(commandObjects.geopos(key, members)); - } - - @Override - public Response> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); - } - - @Override - public Response> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); - } - - @Override - public Response georadiusStore(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); - } - - @Override - public Response georadiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); - } - - @Override - public Response> geosearch(byte[] key, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, radius, unit)); - } - - @Override - public Response> geosearch(byte[] key, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, radius, unit)); - } - - @Override - public Response> geosearch(byte[] key, byte[] member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, width, height, unit)); - } - - @Override - public Response> geosearch(byte[] key, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, width, height, unit)); - } - - @Override - public Response> geosearch(byte[] key, GeoSearchParam params) { - return appendCommand(commandObjects.geosearch(key, params)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, radius, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, byte[] member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStore(dest, src, params)); - } - - @Override - public Response geosearchStoreStoreDist(byte[] dest, byte[] src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStoreStoreDist(dest, src, params)); - } - - @Override - public Response hset(byte[] key, byte[] field, byte[] value) { - return appendCommand(commandObjects.hset(key, field, value)); - } - - @Override - public Response hset(byte[] key, Map hash) { - return appendCommand(commandObjects.hset(key, hash)); - } - - @Override - public Response hget(byte[] key, byte[] field) { - return appendCommand(commandObjects.hget(key, field)); - } - - @Override - public Response hsetnx(byte[] key, byte[] field, byte[] value) { - return appendCommand(commandObjects.hsetnx(key, field, value)); - } - - @Override - public Response hmset(byte[] key, Map hash) { - return appendCommand(commandObjects.hmset(key, hash)); - } - - @Override - public Response> hmget(byte[] key, byte[]... fields) { - return appendCommand(commandObjects.hmget(key, fields)); - } - - @Override - public Response hincrBy(byte[] key, byte[] field, long value) { - return appendCommand(commandObjects.hincrBy(key, field, value)); - } - - @Override - public Response hincrByFloat(byte[] key, byte[] field, double value) { - return appendCommand(commandObjects.hincrByFloat(key, field, value)); - } - - @Override - public Response hexists(byte[] key, byte[] field) { - return appendCommand(commandObjects.hexists(key, field)); - } - - @Override - public Response hdel(byte[] key, byte[]... field) { - return appendCommand(commandObjects.hdel(key, field)); - } - - @Override - public Response hlen(byte[] key) { - return appendCommand(commandObjects.hlen(key)); - } - - @Override - public Response> hkeys(byte[] key) { - return appendCommand(commandObjects.hkeys(key)); - } - - @Override - public Response> hvals(byte[] key) { - return appendCommand(commandObjects.hvals(key)); - } - - @Override - public Response> hgetAll(byte[] key) { - return appendCommand(commandObjects.hgetAll(key)); - } - - @Override - public Response hrandfield(byte[] key) { - return appendCommand(commandObjects.hrandfield(key)); - } - - @Override - public Response> hrandfield(byte[] key, long count) { - return appendCommand(commandObjects.hrandfield(key, count)); - } - - @Override - public Response>> hrandfieldWithValues(byte[] key, long count) { - return appendCommand(commandObjects.hrandfieldWithValues(key, count)); - } - - @Override - public Response>> hscan(byte[] key, byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.hscan(key, cursor, params)); - } - - @Override - public Response hstrlen(byte[] key, byte[] field) { - return appendCommand(commandObjects.hstrlen(key, field)); - } - - @Override - public Response pfadd(byte[] key, byte[]... elements) { - return appendCommand(commandObjects.pfadd(key, elements)); - } - - @Override - public Response pfmerge(byte[] destkey, byte[]... sourcekeys) { - return appendCommand(commandObjects.pfmerge(destkey, sourcekeys)); - } - - @Override - public Response pfcount(byte[] key) { - return appendCommand(commandObjects.pfcount(key)); - } - - @Override - public Response pfcount(byte[]... keys) { - return appendCommand(commandObjects.pfcount(keys)); - } - - @Override - public Response exists(byte[] key) { - return appendCommand(commandObjects.exists(key)); - } - - @Override - public Response exists(byte[]... keys) { - return appendCommand(commandObjects.exists(keys)); - } - - @Override - public Response persist(byte[] key) { - return appendCommand(commandObjects.persist(key)); - } - - @Override - public Response type(byte[] key) { - return appendCommand(commandObjects.type(key)); - } - - @Override - public Response dump(byte[] key) { - return appendCommand(commandObjects.dump(key)); - } - - @Override - public Response restore(byte[] key, long ttl, byte[] serializedValue) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue)); - } - - @Override - public Response restore(byte[] key, long ttl, byte[] serializedValue, RestoreParams params) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue, params)); - } - - @Override - public Response expire(byte[] key, long seconds) { - return appendCommand(commandObjects.expire(key, seconds)); - } - - @Override - public Response expire(byte[] key, long seconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expire(key, seconds, expiryOption)); - } - - @Override - public Response pexpire(byte[] key, long milliseconds) { - return appendCommand(commandObjects.pexpire(key, milliseconds)); - } - - @Override - public Response pexpire(byte[] key, long milliseconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpire(key, milliseconds, expiryOption)); - } - - @Override - public Response expireTime(byte[] key) { - return appendCommand(commandObjects.expireTime(key)); - } - - @Override - public Response pexpireTime(byte[] key) { - return appendCommand(commandObjects.pexpireTime(key)); - } - - @Override - public Response expireAt(byte[] key, long unixTime) { - return appendCommand(commandObjects.expireAt(key, unixTime)); - } - - @Override - public Response expireAt(byte[] key, long unixTime, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expireAt(key, unixTime)); - } - - @Override - public Response pexpireAt(byte[] key, long millisecondsTimestamp) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp)); - } - - @Override - public Response pexpireAt(byte[] key, long millisecondsTimestamp, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp, expiryOption)); - } - - @Override - public Response ttl(byte[] key) { - return appendCommand(commandObjects.ttl(key)); - } - - @Override - public Response pttl(byte[] key) { - return appendCommand(commandObjects.pttl(key)); - } - - @Override - public Response touch(byte[] key) { - return appendCommand(commandObjects.touch(key)); - } - - @Override - public Response touch(byte[]... keys) { - return appendCommand(commandObjects.touch(keys)); - } - - @Override - public Response> sort(byte[] key) { - return appendCommand(commandObjects.sort(key)); - } - - @Override - public Response> sort(byte[] key, SortingParams sortingParams) { - return appendCommand(commandObjects.sort(key, sortingParams)); - } - - @Override - public Response> sortReadonly(byte[] key, SortingParams sortingParams) { - return appendCommand(commandObjects.sortReadonly(key, sortingParams)); - } - - @Override - public Response del(byte[] key) { - return appendCommand(commandObjects.del(key)); - } - - @Override - public Response del(byte[]... keys) { - return appendCommand(commandObjects.del(keys)); - } - - @Override - public Response unlink(byte[] key) { - return appendCommand(commandObjects.unlink(key)); - } - - @Override - public Response unlink(byte[]... keys) { - return appendCommand(commandObjects.unlink(keys)); - } - - @Override - public Response copy(byte[] srcKey, byte[] dstKey, boolean replace) { - return appendCommand(commandObjects.copy(srcKey, dstKey, replace)); - } - - @Override - public Response rename(byte[] oldkey, byte[] newkey) { - return appendCommand(commandObjects.rename(oldkey, newkey)); - } - - @Override - public Response renamenx(byte[] oldkey, byte[] newkey) { - return appendCommand(commandObjects.renamenx(oldkey, newkey)); - } - - @Override - public Response sort(byte[] key, SortingParams sortingParams, byte[] dstkey) { - return appendCommand(commandObjects.sort(key, sortingParams, dstkey)); - } - - @Override - public Response sort(byte[] key, byte[] dstkey) { - return appendCommand(commandObjects.sort(key, dstkey)); - } - - @Override - public Response memoryUsage(byte[] key) { - return appendCommand(commandObjects.memoryUsage(key)); - } - - @Override - public Response memoryUsage(byte[] key, int samples) { - return appendCommand(commandObjects.memoryUsage(key, samples)); - } - - @Override - public Response objectRefcount(byte[] key) { - return appendCommand(commandObjects.objectRefcount(key)); - } - - @Override - public Response objectEncoding(byte[] key) { - return appendCommand(commandObjects.objectEncoding(key)); - } - - @Override - public Response objectIdletime(byte[] key) { - return appendCommand(commandObjects.objectIdletime(key)); - } - - @Override - public Response objectFreq(byte[] key) { - return appendCommand(commandObjects.objectFreq(key)); - } - - @Override - public Response migrate(String host, int port, byte[] key, int timeout) { - return appendCommand(commandObjects.migrate(host, port, key, timeout)); - } - - @Override - public Response migrate(String host, int port, int timeout, MigrateParams params, byte[]... keys) { - return appendCommand(commandObjects.migrate(host, port, timeout, params, keys)); - } - - @Override - public Response> keys(byte[] pattern) { - return appendCommand(commandObjects.keys(pattern)); - } - - @Override - public Response> scan(byte[] cursor) { - return appendCommand(commandObjects.scan(cursor)); - } - - @Override - public Response> scan(byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.scan(cursor, params)); - } - - @Override - public Response> scan(byte[] cursor, ScanParams params, byte[] type) { - return appendCommand(commandObjects.scan(cursor, params, type)); - } - - @Override - public Response randomBinaryKey() { - return appendCommand(commandObjects.randomBinaryKey()); - } - - @Override - public Response rpush(byte[] key, byte[]... args) { - return appendCommand(commandObjects.rpush(key, args)); - } - - @Override - public Response lpush(byte[] key, byte[]... args) { - return appendCommand(commandObjects.lpush(key, args)); - } - - @Override - public Response llen(byte[] key) { - return appendCommand(commandObjects.llen(key)); - } - - @Override - public Response> lrange(byte[] key, long start, long stop) { - return appendCommand(commandObjects.lrange(key, start, stop)); - } - - @Override - public Response ltrim(byte[] key, long start, long stop) { - return appendCommand(commandObjects.ltrim(key, start, stop)); - } - - @Override - public Response lindex(byte[] key, long index) { - return appendCommand(commandObjects.lindex(key, index)); - } - - @Override - public Response lset(byte[] key, long index, byte[] value) { - return appendCommand(commandObjects.lset(key, index, value)); - } - - @Override - public Response lrem(byte[] key, long count, byte[] value) { - return appendCommand(commandObjects.lrem(key, count, value)); - } - - @Override - public Response lpop(byte[] key) { - return appendCommand(commandObjects.lpop(key)); - } - - @Override - public Response> lpop(byte[] key, int count) { - return appendCommand(commandObjects.lpop(key, count)); - } - - @Override - public Response lpos(byte[] key, byte[] element) { - return appendCommand(commandObjects.lpos(key, element)); - } - - @Override - public Response lpos(byte[] key, byte[] element, LPosParams params) { - return appendCommand(commandObjects.lpos(key, element, params)); - } - - @Override - public Response> lpos(byte[] key, byte[] element, LPosParams params, long count) { - return appendCommand(commandObjects.lpos(key, element, params, count)); - } - - @Override - public Response rpop(byte[] key) { - return appendCommand(commandObjects.rpop(key)); - } - - @Override - public Response> rpop(byte[] key, int count) { - return appendCommand(commandObjects.rpop(key, count)); - } - - @Override - public Response linsert(byte[] key, ListPosition where, byte[] pivot, byte[] value) { - return appendCommand(commandObjects.linsert(key, where, pivot, value)); - } - - @Override - public Response lpushx(byte[] key, byte[]... args) { - return appendCommand(commandObjects.lpushx(key, args)); - } - - @Override - public Response rpushx(byte[] key, byte[]... args) { - return appendCommand(commandObjects.rpushx(key, args)); - } - - @Override - public Response> blpop(int timeout, byte[]... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> blpop(double timeout, byte[]... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> brpop(int timeout, byte[]... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response> brpop(double timeout, byte[]... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response rpoplpush(byte[] srckey, byte[] dstkey) { - return appendCommand(commandObjects.rpoplpush(srckey, dstkey)); - } - - @Override - public Response brpoplpush(byte[] source, byte[] destination, int timeout) { - return appendCommand(commandObjects.brpoplpush(source, destination, timeout)); - } - - @Override - public Response lmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to) { - return appendCommand(commandObjects.lmove(srcKey, dstKey, from, to)); - } - - @Override - public Response blmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to, double timeout) { - return appendCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); - } - - @Override - public Response>> lmpop(ListDirection direction, byte[]... keys) { - return appendCommand(commandObjects.lmpop(direction, keys)); - } - - @Override - public Response>> lmpop(ListDirection direction, int count, byte[]... keys) { - return appendCommand(commandObjects.lmpop(direction, count, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, byte[]... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); - } - - @Override - public Response waitReplicas(byte[] sampleKey, int replicas, long timeout) { - return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); - } - - @Override - public Response> waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) { - return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); - } - - @Override - public Response eval(byte[] script, byte[] sampleKey) { - return appendCommand(commandObjects.eval(script, sampleKey)); - } - - @Override - public Response evalsha(byte[] sha1, byte[] sampleKey) { - return appendCommand(commandObjects.evalsha(sha1, sampleKey)); - } - - @Override - public Response> scriptExists(byte[] sampleKey, byte[]... sha1s) { - return appendCommand(commandObjects.scriptExists(sampleKey, sha1s)); - } - - @Override - public Response scriptLoad(byte[] script, byte[] sampleKey) { - return appendCommand(commandObjects.scriptLoad(script, sampleKey)); - } - - @Override - public Response scriptFlush(byte[] sampleKey) { - return appendCommand(commandObjects.scriptFlush(sampleKey)); - } - - @Override - public Response scriptFlush(byte[] sampleKey, FlushMode flushMode) { - return appendCommand(commandObjects.scriptFlush(sampleKey, flushMode)); - } - - @Override - public Response scriptKill(byte[] sampleKey) { - return appendCommand(commandObjects.scriptKill(sampleKey)); - } - - @Override - public Response eval(byte[] script) { - return appendCommand(commandObjects.eval(script)); - } - - @Override - public Response eval(byte[] script, int keyCount, byte[]... params) { - return appendCommand(commandObjects.eval(script, keyCount, params)); - } - - @Override - public Response eval(byte[] script, List keys, List args) { - return appendCommand(commandObjects.eval(script, keys, args)); - } - - @Override - public Response evalReadonly(byte[] script, List keys, List args) { - return appendCommand(commandObjects.evalReadonly(script, keys, args)); - } - - @Override - public Response evalsha(byte[] sha1) { - return appendCommand(commandObjects.evalsha(sha1)); - } - - @Override - public Response evalsha(byte[] sha1, int keyCount, byte[]... params) { - return appendCommand(commandObjects.evalsha(sha1, keyCount, params)); - } - - @Override - public Response evalsha(byte[] sha1, List keys, List args) { - return appendCommand(commandObjects.evalsha(sha1, keys, args)); - } - - @Override - public Response evalshaReadonly(byte[] sha1, List keys, List args) { - return appendCommand(commandObjects.evalshaReadonly(sha1, keys, args)); - } - - @Override - public Response sadd(byte[] key, byte[]... members) { - return appendCommand(commandObjects.sadd(key, members)); - } - - @Override - public Response> smembers(byte[] key) { - return appendCommand(commandObjects.smembers(key)); - } - - @Override - public Response srem(byte[] key, byte[]... members) { - return appendCommand(commandObjects.srem(key, members)); - } - - @Override - public Response spop(byte[] key) { - return appendCommand(commandObjects.spop(key)); - } - - @Override - public Response> spop(byte[] key, long count) { - return appendCommand(commandObjects.spop(key, count)); - } - - @Override - public Response scard(byte[] key) { - return appendCommand(commandObjects.scard(key)); - } - - @Override - public Response sismember(byte[] key, byte[] member) { - return appendCommand(commandObjects.sismember(key, member)); - } - - @Override - public Response> smismember(byte[] key, byte[]... members) { - return appendCommand(commandObjects.smismember(key, members)); - } - - @Override - public Response srandmember(byte[] key) { - return appendCommand(commandObjects.srandmember(key)); - } - - @Override - public Response> srandmember(byte[] key, int count) { - return appendCommand(commandObjects.srandmember(key, count)); - } - - @Override - public Response> sscan(byte[] key, byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.sscan(key, cursor, params)); - } - - @Override - public Response> sdiff(byte[]... keys) { - return appendCommand(commandObjects.sdiff(keys)); - } - - @Override - public Response sdiffstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.sdiffstore(dstkey, keys)); - } - - @Override - public Response> sinter(byte[]... keys) { - return appendCommand(commandObjects.sinter(keys)); - } - - @Override - public Response sinterstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.sinterstore(dstkey, keys)); - } - - @Override - public Response sintercard(byte[]... keys) { - return appendCommand(commandObjects.sintercard(keys)); - } - - @Override - public Response sintercard(int limit, byte[]... keys) { - return appendCommand(commandObjects.sintercard(limit, keys)); - } - - @Override - public Response> sunion(byte[]... keys) { - return appendCommand(commandObjects.sunion(keys)); - } - - @Override - public Response sunionstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.sunionstore(dstkey, keys)); - } - - @Override - public Response smove(byte[] srckey, byte[] dstkey, byte[] member) { - return appendCommand(commandObjects.smove(srckey, dstkey, member)); - } - - @Override - public Response zadd(byte[] key, double score, byte[] member) { - return appendCommand(commandObjects.zadd(key, score, member)); - } - - @Override - public Response zadd(byte[] key, double score, byte[] member, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, score, member, params)); - } - - @Override - public Response zadd(byte[] key, Map scoreMembers) { - return appendCommand(commandObjects.zadd(key, scoreMembers)); - } - - @Override - public Response zadd(byte[] key, Map scoreMembers, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, scoreMembers, params)); - } - - @Override - public Response zaddIncr(byte[] key, double score, byte[] member, ZAddParams params) { - return appendCommand(commandObjects.zaddIncr(key, score, member, params)); - } - - @Override - public Response zrem(byte[] key, byte[]... members) { - return appendCommand(commandObjects.zrem(key, members)); - } - - @Override - public Response zincrby(byte[] key, double increment, byte[] member) { - return appendCommand(commandObjects.zincrby(key, increment, member)); - } - - @Override - public Response zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params) { - return appendCommand(commandObjects.zincrby(key, increment, member, params)); - } - - @Override - public Response zrank(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrank(key, member)); - } - - @Override - public Response zrevrank(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrevrank(key, member)); - } - - @Override - public Response> zrankWithScore(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrankWithScore(key, member)); - } - - @Override - public Response> zrevrankWithScore(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrevrankWithScore(key, member)); - } - - @Override - public Response> zrange(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrange(key, start, stop)); - } - - @Override - public Response> zrevrange(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrevrange(key, start, stop)); - } - - @Override - public Response> zrangeWithScores(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrangeWithScores(key, start, stop)); - } - - @Override - public Response> zrevrangeWithScores(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrevrangeWithScores(key, start, stop)); - } - - @Override - public Response zrandmember(byte[] key) { - return appendCommand(commandObjects.zrandmember(key)); - } - - @Override - public Response> zrandmember(byte[] key, long count) { - return appendCommand(commandObjects.zrandmember(key, count)); - } - - @Override - public Response> zrandmemberWithScores(byte[] key, long count) { - return appendCommand(commandObjects.zrandmemberWithScores(key, count)); - } - - @Override - public Response zcard(byte[] key) { - return appendCommand(commandObjects.zcard(key)); - } - - @Override - public Response zscore(byte[] key, byte[] member) { - return appendCommand(commandObjects.zscore(key, member)); - } - - @Override - public Response> zmscore(byte[] key, byte[]... members) { - return appendCommand(commandObjects.zmscore(key, members)); - } - - @Override - public Response zpopmax(byte[] key) { - return appendCommand(commandObjects.zpopmax(key)); - } - - @Override - public Response> zpopmax(byte[] key, int count) { - return appendCommand(commandObjects.zpopmax(key, count)); - } - - @Override - public Response zpopmin(byte[] key) { - return appendCommand(commandObjects.zpopmin(key)); - } - - @Override - public Response> zpopmin(byte[] key, int count) { - return appendCommand(commandObjects.zpopmin(key, count)); - } - - @Override - public Response zcount(byte[] key, double min, double max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response zcount(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response> zrangeByScore(byte[] key, double min, double max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrangeByScore(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - } - - @Override - public Response> zrangeByScore(byte[] key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, byte[] max, byte[] min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - } - - @Override - public Response> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, double min, double max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response zremrangeByRank(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zremrangeByRank(key, start, stop)); - } - - @Override - public Response zremrangeByScore(byte[] key, double min, double max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zremrangeByScore(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zlexcount(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zlexcount(key, min, max)); - } - - @Override - public Response> zrangeByLex(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zrangeByLex(key, min, max)); - } - - @Override - public Response> zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count) { - return appendCommand(commandObjects.zrangeByLex(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByLex(byte[] key, byte[] max, byte[] min) { - return appendCommand(commandObjects.zrevrangeByLex(key, max, min)); - } - - @Override - public Response> zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByLex(key, max, min, offset, count)); - } - - @Override - public Response> zrange(byte[] key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrange(key, zRangeParams)); - } - - @Override - public Response> zrangeWithScores(byte[] key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangeWithScores(key, zRangeParams)); - } - - @Override - public Response zrangestore(byte[] dest, byte[] src, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangestore(dest, src, zRangeParams)); - } - - @Override - public Response zremrangeByLex(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zremrangeByLex(key, min, max)); - } - - @Override - public Response> zscan(byte[] key, byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.zscan(key, cursor, params)); - } - - @Override - public Response> bzpopmax(double timeout, byte[]... keys) { - return appendCommand(commandObjects.bzpopmax(timeout, keys)); - } - - @Override - public Response> bzpopmin(double timeout, byte[]... keys) { - return appendCommand(commandObjects.bzpopmin(timeout, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, byte[]... keys) { - return appendCommand(commandObjects.zmpop(option, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, int count, byte[]... keys) { - return appendCommand(commandObjects.zmpop(option, count, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); - } - - @Override - public Response> zdiff(byte[]... keys) { - return appendCommand(commandObjects.zdiff(keys)); - } - - @Override - public Response> zdiffWithScores(byte[]... keys) { - return appendCommand(commandObjects.zdiffWithScores(keys)); - } - - @Override - @Deprecated - public Response zdiffStore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.zdiffStore(dstkey, keys)); - } - - @Override - public Response zdiffstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.zdiffstore(dstkey, keys)); - } - - @Override - public Response> zinter(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zinter(params, keys)); - } - - @Override - public Response> zinterWithScores(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zinterWithScores(params, keys)); - } - - @Override - public Response zinterstore(byte[] dstkey, byte[]... sets) { - return appendCommand(commandObjects.zinterstore(dstkey, sets)); - } - - @Override - public Response zinterstore(byte[] dstkey, ZParams params, byte[]... sets) { - return appendCommand(commandObjects.zinterstore(dstkey, params, sets)); - } - - @Override - public Response zintercard(byte[]... keys) { - return appendCommand(commandObjects.zintercard(keys)); - } - - @Override - public Response zintercard(long limit, byte[]... keys) { - return appendCommand(commandObjects.zintercard(limit, keys)); - } - - @Override - public Response> zunion(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zunion(params, keys)); - } - - @Override - public Response> zunionWithScores(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zunionWithScores(params, keys)); - } - - @Override - public Response zunionstore(byte[] dstkey, byte[]... sets) { - return appendCommand(commandObjects.zunionstore(dstkey, sets)); - } - - @Override - public Response zunionstore(byte[] dstkey, ZParams params, byte[]... sets) { - return appendCommand(commandObjects.zunionstore(dstkey, params, sets)); - } - - @Override - public Response xadd(byte[] key, XAddParams params, Map hash) { - return appendCommand(commandObjects.xadd(key, params, hash)); - } - - @Override - public Response xlen(byte[] key) { - return appendCommand(commandObjects.xlen(key)); - } - - @Override - public Response> xrange(byte[] key, byte[] start, byte[] end) { - return appendCommand(commandObjects.xrange(key, start, end)); - } - - @Override - public Response> xrange(byte[] key, byte[] start, byte[] end, int count) { - return appendCommand(commandObjects.xrange(key, start, end, count)); - } - - @Override - public Response> xrevrange(byte[] key, byte[] end, byte[] start) { - return appendCommand(commandObjects.xrevrange(key, end, start)); - } - - @Override - public Response> xrevrange(byte[] key, byte[] end, byte[] start, int count) { - return appendCommand(commandObjects.xrevrange(key, end, start, count)); - } - - @Override - public Response xack(byte[] key, byte[] group, byte[]... ids) { - return appendCommand(commandObjects.xack(key, group, ids)); - } - - @Override - public Response xgroupCreate(byte[] key, byte[] groupName, byte[] id, boolean makeStream) { - return appendCommand(commandObjects.xgroupCreate(key, groupName, id, makeStream)); - } - - @Override - public Response xgroupSetID(byte[] key, byte[] groupName, byte[] id) { - return appendCommand(commandObjects.xgroupSetID(key, groupName, id)); - } - - @Override - public Response xgroupDestroy(byte[] key, byte[] groupName) { - return appendCommand(commandObjects.xgroupDestroy(key, groupName)); - } - - @Override - public Response xgroupCreateConsumer(byte[] key, byte[] groupName, byte[] consumerName) { - return appendCommand(commandObjects.xgroupCreateConsumer(key, groupName, consumerName)); - } - - @Override - public Response xgroupDelConsumer(byte[] key, byte[] groupName, byte[] consumerName) { - return appendCommand(commandObjects.xgroupDelConsumer(key, groupName, consumerName)); - } - - @Override - public Response xdel(byte[] key, byte[]... ids) { - return appendCommand(commandObjects.xdel(key, ids)); - } - - @Override - public Response xtrim(byte[] key, long maxLen, boolean approximateLength) { - return appendCommand(commandObjects.xtrim(key, maxLen, approximateLength)); - } - - @Override - public Response xtrim(byte[] key, XTrimParams params) { - return appendCommand(commandObjects.xtrim(key, params)); - } - - @Override - public Response xpending(byte[] key, byte[] groupName) { - return appendCommand(commandObjects.xpending(key, groupName)); - } - - @Override - public Response> xpending(byte[] key, byte[] groupName, XPendingParams params) { - return appendCommand(commandObjects.xpending(key, groupName, params)); - } - - @Override - public Response> xclaim(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { - return appendCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response> xclaimJustId(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { - return appendCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response> xautoclaim(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaim(key, groupName, consumerName, minIdleTime, start, params)); - } - - @Override - public Response> xautoclaimJustId(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaimJustId(key, groupName, consumerName, minIdleTime, start, params)); - } - - @Override - public Response xinfoStream(byte[] key) { - return appendCommand(commandObjects.xinfoStream(key)); - } - - @Override - public Response xinfoStreamFull(byte[] key) { - return appendCommand(commandObjects.xinfoStreamFull(key)); - } - - @Override - public Response xinfoStreamFull(byte[] key, int count) { - return appendCommand(commandObjects.xinfoStreamFull(key, count)); - } - - @Override - public Response> xinfoGroups(byte[] key) { - return appendCommand(commandObjects.xinfoGroups(key)); - } - - @Override - public Response> xinfoConsumers(byte[] key, byte[] group) { - return appendCommand(commandObjects.xinfoConsumers(key, group)); - } - - @Override - public Response> xread(XReadParams xReadParams, Map.Entry... streams) { - return appendCommand(commandObjects.xread(xReadParams, streams)); - } - - @Override - public Response> xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Map.Entry... streams) { - return appendCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); - } - - @Override - public Response set(byte[] key, byte[] value) { - return appendCommand(commandObjects.set(key, value)); - } - - @Override - public Response set(byte[] key, byte[] value, SetParams params) { - return appendCommand(commandObjects.set(key, value, params)); - } - - @Override - public Response get(byte[] key) { - return appendCommand(commandObjects.get(key)); - } - - @Override - public Response setGet(byte[] key, byte[] value, SetParams params) { - return appendCommand(commandObjects.setGet(key, value, params)); - } - - @Override - public Response getDel(byte[] key) { - return appendCommand(commandObjects.getDel(key)); - } - - @Override - public Response getEx(byte[] key, GetExParams params) { - return appendCommand(commandObjects.getEx(key, params)); - } - - @Override - public Response setbit(byte[] key, long offset, boolean value) { - return appendCommand(commandObjects.setbit(key, offset, value)); - } - - @Override - public Response getbit(byte[] key, long offset) { - return appendCommand(commandObjects.getbit(key, offset)); - } - - @Override - public Response setrange(byte[] key, long offset, byte[] value) { - return appendCommand(commandObjects.setrange(key, offset, value)); - } - - @Override - public Response getrange(byte[] key, long startOffset, long endOffset) { - return appendCommand(commandObjects.getrange(key, startOffset, endOffset)); - } - - @Override - public Response getSet(byte[] key, byte[] value) { - return appendCommand(commandObjects.getSet(key, value)); - } - - @Override - public Response setnx(byte[] key, byte[] value) { - return appendCommand(commandObjects.setnx(key, value)); - } - - @Override - public Response setex(byte[] key, long seconds, byte[] value) { - return appendCommand(commandObjects.setex(key, seconds, value)); - } - - @Override - public Response psetex(byte[] key, long milliseconds, byte[] value) { - return appendCommand(commandObjects.psetex(key, milliseconds, value)); - } - - @Override - public Response> mget(byte[]... keys) { - return appendCommand(commandObjects.mget(keys)); - } - - @Override - public Response mset(byte[]... keysvalues) { - return appendCommand(commandObjects.mset(keysvalues)); - } - - @Override - public Response msetnx(byte[]... keysvalues) { - return appendCommand(commandObjects.msetnx(keysvalues)); - } - - @Override - public Response incr(byte[] key) { - return appendCommand(commandObjects.incr(key)); - } - - @Override - public Response incrBy(byte[] key, long increment) { - return appendCommand(commandObjects.incrBy(key, increment)); - } - - @Override - public Response incrByFloat(byte[] key, double increment) { - return appendCommand(commandObjects.incrByFloat(key, increment)); - } - - @Override - public Response decr(byte[] key) { - return appendCommand(commandObjects.decr(key)); - } - - @Override - public Response decrBy(byte[] key, long decrement) { - return appendCommand(commandObjects.decrBy(key, decrement)); - } - - @Override - public Response append(byte[] key, byte[] value) { - return appendCommand(commandObjects.append(key, value)); - } - - @Override - public Response substr(byte[] key, int start, int end) { - return appendCommand(commandObjects.substr(key, start, end)); - } - - @Override - public Response strlen(byte[] key) { - return appendCommand(commandObjects.strlen(key)); - } - - @Override - public Response bitcount(byte[] key) { - return appendCommand(commandObjects.bitcount(key)); - } - - @Override - public Response bitcount(byte[] key, long start, long end) { - return appendCommand(commandObjects.bitcount(key, start, end)); - } - - @Override - public Response bitcount(byte[] key, long start, long end, BitCountOption option) { - return appendCommand(commandObjects.bitcount(key, start, end, option)); - } - - @Override - public Response bitpos(byte[] key, boolean value) { - return appendCommand(commandObjects.bitpos(key, value)); - } - - @Override - public Response bitpos(byte[] key, boolean value, BitPosParams params) { - return appendCommand(commandObjects.bitpos(key, value, params)); - } - - @Override - public Response> bitfield(byte[] key, byte[]... arguments) { - return appendCommand(commandObjects.bitfield(key, arguments)); - } - - @Override - public Response> bitfieldReadonly(byte[] key, byte[]... arguments) { - return appendCommand(commandObjects.bitfieldReadonly(key, arguments)); - } - - @Override - public Response bitop(BitOP op, byte[] destKey, byte[]... srcKeys) { - return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); - } - - // RediSearch commands - @Override - public Response ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { - return appendCommand(commandObjects.ftCreate(indexName, indexOptions, schema)); - } - - @Override - public Response ftCreate(String indexName, FTCreateParams createParams, Iterable schemaFields) { - return appendCommand(commandObjects.ftCreate(indexName, createParams, schemaFields)); - } - - @Override - public Response ftAlter(String indexName, Schema schema) { - return appendCommand(commandObjects.ftAlter(indexName, schema)); - } - - @Override - public Response ftAlter(String indexName, Iterable schemaFields) { - return appendCommand(commandObjects.ftAlter(indexName, schemaFields)); - } - - @Override - public Response ftSearch(String indexName, String query) { - return appendCommand(commandObjects.ftSearch(indexName, query)); - } - - @Override - public Response ftSearch(String indexName, String query, FTSearchParams searchParams) { - return appendCommand(commandObjects.ftSearch(indexName, query, searchParams)); - } - - @Override - public Response ftSearch(String indexName, Query query) { - return appendCommand(commandObjects.ftSearch(indexName, query)); - } - - @Override - public Response ftSearch(byte[] indexName, Query query) { - return appendCommand(commandObjects.ftSearch(indexName, query)); - } - - @Override - public Response ftExplain(String indexName, Query query) { - return appendCommand(commandObjects.ftExplain(indexName, query)); - } - - @Override - public Response> ftExplainCLI(String indexName, Query query) { - return appendCommand(commandObjects.ftExplainCLI(indexName, query)); - } - - @Override - public Response ftAggregate(String indexName, AggregationBuilder aggr) { - return appendCommand(commandObjects.ftAggregate(indexName, aggr)); - } - - @Override - public Response ftSynUpdate(String indexName, String synonymGroupId, String... terms) { - return appendCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms)); - } - - @Override - public Response>> ftSynDump(String indexName) { - return appendCommand(commandObjects.ftSynDump(indexName)); - } - - @Override - public Response ftDictAdd(String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictAdd(dictionary, terms)); - } - - @Override - public Response ftDictDel(String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictDel(dictionary, terms)); - } - - @Override - public Response> ftDictDump(String dictionary) { - return appendCommand(commandObjects.ftDictDump(dictionary)); - } - - @Override - public Response ftDictAddBySampleKey(String indexName, String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictAddBySampleKey(indexName, dictionary, terms)); - } - - @Override - public Response ftDictDelBySampleKey(String indexName, String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictDelBySampleKey(indexName, dictionary, terms)); - } - - @Override - public Response> ftDictDumpBySampleKey(String indexName, String dictionary) { - return appendCommand(commandObjects.ftDictDumpBySampleKey(indexName, dictionary)); - } - - @Override - public Response>> ftSpellCheck(String index, String query) { - return appendCommand(commandObjects.ftSpellCheck(index, query)); - } - - @Override - public Response>> ftSpellCheck(String index, String query, FTSpellCheckParams spellCheckParams) { - return appendCommand(commandObjects.ftSpellCheck(index, query, spellCheckParams)); - } - - @Override - public Response> ftInfo(String indexName) { - return appendCommand(commandObjects.ftInfo(indexName)); - } - - @Override - public Response> ftTagVals(String indexName, String fieldName) { - return appendCommand(commandObjects.ftTagVals(indexName, fieldName)); - } - - @Override - public Response> ftConfigGet(String option) { - return appendCommand(commandObjects.ftConfigGet(option)); - } - - @Override - public Response> ftConfigGet(String indexName, String option) { - return appendCommand(commandObjects.ftConfigGet(indexName, option)); - } - - @Override - public Response ftConfigSet(String option, String value) { - return appendCommand(commandObjects.ftConfigSet(option, value)); - } - - @Override - public Response ftConfigSet(String indexName, String option, String value) { - return appendCommand(commandObjects.ftConfigSet(indexName, option, value)); - } - - @Override - public Response ftSugAdd(String key, String string, double score) { - return appendCommand(commandObjects.ftSugAdd(key, string, score)); - } - - @Override - public Response ftSugAddIncr(String key, String string, double score) { - return appendCommand(commandObjects.ftSugAddIncr(key, string, score)); - } - - @Override - public Response> ftSugGet(String key, String prefix) { - return appendCommand(commandObjects.ftSugGet(key, prefix)); - } - - @Override - public Response> ftSugGet(String key, String prefix, boolean fuzzy, int max) { - return appendCommand(commandObjects.ftSugGet(key, prefix, fuzzy, max)); - } - - @Override - public Response> ftSugGetWithScores(String key, String prefix) { - return appendCommand(commandObjects.ftSugGetWithScores(key, prefix)); - } - - @Override - public Response> ftSugGetWithScores(String key, String prefix, boolean fuzzy, int max) { - return appendCommand(commandObjects.ftSugGetWithScores(key, prefix, fuzzy, max)); - } - - @Override - public Response ftSugDel(String key, String string) { - return appendCommand(commandObjects.ftSugDel(key, string)); - } - - @Override - public Response ftSugLen(String key) { - return appendCommand(commandObjects.ftSugLen(key)); - } - // RediSearch commands - - // RedisJSON commands - @Override - public Response lcs(byte[] keyA, byte[] keyB, LCSParams params) { - return appendCommand(commandObjects.lcs(keyA, keyB, params)); - } - - @Override - public Response jsonSet(String key, Path2 path, Object object) { - return appendCommand(commandObjects.jsonSet(key, path, object)); - } - - @Override - public Response jsonSetWithEscape(String key, Path2 path, Object object) { - return appendCommand(commandObjects.jsonSetWithEscape(key, path, object)); - } - - @Override - public Response jsonSet(String key, Path path, Object object) { - return appendCommand(commandObjects.jsonSet(key, path, object)); - } - - @Override - public Response jsonSet(String key, Path2 path, Object object, JsonSetParams params) { - return appendCommand(commandObjects.jsonSet(key, path, object, params)); - } - - @Override - public Response jsonSetWithEscape(String key, Path2 path, Object object, JsonSetParams params) { - return appendCommand(commandObjects.jsonSetWithEscape(key, path, object, params)); - } - - @Override - public Response jsonSet(String key, Path path, Object object, JsonSetParams params) { - return appendCommand(commandObjects.jsonSet(key, path, object, params)); - } - - @Override - public Response jsonMerge(String key, Path2 path, Object object) { - return appendCommand(commandObjects.jsonMerge(key, path, object)); - } - - @Override - public Response jsonMerge(String key, Path path, Object object) { - return appendCommand(commandObjects.jsonMerge(key, path, object)); - } - - @Override - public Response jsonGet(String key) { - return appendCommand(commandObjects.jsonGet(key)); - } - - @Override - public Response jsonGet(String key, Class clazz) { - return appendCommand(commandObjects.jsonGet(key, clazz)); - } - - @Override - public Response jsonGet(String key, Path2... paths) { - return appendCommand(commandObjects.jsonGet(key, paths)); - } - - @Override - public Response jsonGet(String key, Path... paths) { - return appendCommand(commandObjects.jsonGet(key, paths)); - } - - @Override - public Response jsonGet(String key, Class clazz, Path... paths) { - return appendCommand(commandObjects.jsonGet(key, clazz, paths)); - } - - @Override - public Response> jsonMGet(Path2 path, String... keys) { - return appendCommand(commandObjects.jsonMGet(path, keys)); - } - - @Override - public Response> jsonMGet(Path path, Class clazz, String... keys) { - return appendCommand(commandObjects.jsonMGet(path, clazz, keys)); - } - - @Override - public Response jsonDel(String key) { - return appendCommand(commandObjects.jsonDel(key)); - } - - @Override - public Response jsonDel(String key, Path2 path) { - return appendCommand(commandObjects.jsonDel(key, path)); - } - - @Override - public Response jsonDel(String key, Path path) { - return appendCommand(commandObjects.jsonDel(key, path)); - } - - @Override - public Response jsonClear(String key) { - return appendCommand(commandObjects.jsonClear(key)); - } - - @Override - public Response jsonClear(String key, Path2 path) { - return appendCommand(commandObjects.jsonClear(key, path)); - } - - @Override - public Response jsonClear(String key, Path path) { - return appendCommand(commandObjects.jsonClear(key, path)); - } - - @Override - public Response> jsonToggle(String key, Path2 path) { - return appendCommand(commandObjects.jsonToggle(key, path)); - } - - @Override - public Response jsonToggle(String key, Path path) { - return appendCommand(commandObjects.jsonToggle(key, path)); - } - - @Override - public Response> jsonType(String key) { - return appendCommand(commandObjects.jsonType(key)); - } - - @Override - public Response>> jsonType(String key, Path2 path) { - return appendCommand(commandObjects.jsonType(key, path)); - } - - @Override - public Response> jsonType(String key, Path path) { - return appendCommand(commandObjects.jsonType(key, path)); - } - - @Override - public Response jsonStrAppend(String key, Object string) { - return appendCommand(commandObjects.jsonStrAppend(key, string)); - } - - @Override - public Response> jsonStrAppend(String key, Path2 path, Object string) { - return appendCommand(commandObjects.jsonStrAppend(key, path, string)); - } - - @Override - public Response jsonStrAppend(String key, Path path, Object string) { - return appendCommand(commandObjects.jsonStrAppend(key, path, string)); - } - - @Override - public Response jsonStrLen(String key) { - return appendCommand(commandObjects.jsonStrLen(key)); - } - - @Override - public Response> jsonStrLen(String key, Path2 path) { - return appendCommand(commandObjects.jsonStrLen(key, path)); - } - - @Override - public Response jsonStrLen(String key, Path path) { - return appendCommand(commandObjects.jsonStrLen(key, path)); - } - - @Override - public Response jsonNumIncrBy(String key, Path2 path, double value) { - return appendCommand(commandObjects.jsonNumIncrBy(key, path, value)); - } - - @Override - public Response jsonNumIncrBy(String key, Path path, double value) { - return appendCommand(commandObjects.jsonNumIncrBy(key, path, value)); - } - - @Override - public Response> jsonArrAppend(String key, Path2 path, Object... objects) { - return appendCommand(commandObjects.jsonArrAppend(key, path, objects)); - } - - @Override - public Response> jsonArrAppendWithEscape(String key, Path2 path, Object... objects) { - return appendCommand(commandObjects.jsonArrAppendWithEscape(key, path, objects)); - } - - @Override - public Response jsonArrAppend(String key, Path path, Object... objects) { - return appendCommand(commandObjects.jsonArrAppend(key, path, objects)); - } - - @Override - public Response> jsonArrIndex(String key, Path2 path, Object scalar) { - return appendCommand(commandObjects.jsonArrIndex(key, path, scalar)); - } - - @Override - public Response> jsonArrIndexWithEscape(String key, Path2 path, Object scalar) { - return appendCommand(commandObjects.jsonArrIndexWithEscape(key, path, scalar)); - } - - @Override - public Response jsonArrIndex(String key, Path path, Object scalar) { - return appendCommand(commandObjects.jsonArrIndex(key, path, scalar)); - } - - @Override - public Response> jsonArrInsert(String key, Path2 path, int index, Object... objects) { - return appendCommand(commandObjects.jsonArrInsert(key, path, index, objects)); - } - - @Override - public Response> jsonArrInsertWithEscape(String key, Path2 path, int index, Object... objects) { - return appendCommand(commandObjects.jsonArrInsertWithEscape(key, path, index, objects)); - } - - @Override - public Response jsonArrInsert(String key, Path path, int index, Object... pojos) { - return appendCommand(commandObjects.jsonArrInsert(key, path, index, pojos)); - } - - @Override - public Response jsonArrPop(String key) { - return appendCommand(commandObjects.jsonArrPop(key)); - } - - @Override - public Response jsonArrLen(String key, Path path) { - return appendCommand(commandObjects.jsonArrLen(key, path)); - } - - @Override - public Response> jsonArrTrim(String key, Path2 path, int start, int stop) { - return appendCommand(commandObjects.jsonArrTrim(key, path, start, stop)); - } - - @Override - public Response jsonArrTrim(String key, Path path, int start, int stop) { - return appendCommand(commandObjects.jsonArrTrim(key, path, start, stop)); - } - - @Override - public Response jsonArrPop(String key, Class clazz, Path path) { - return appendCommand(commandObjects.jsonArrPop(key, clazz, path)); - } - - @Override - public Response> jsonArrPop(String key, Path2 path, int index) { - return appendCommand(commandObjects.jsonArrPop(key, path, index)); - } - - @Override - public Response jsonArrPop(String key, Path path, int index) { - return appendCommand(commandObjects.jsonArrPop(key, path, index)); - } - - @Override - public Response jsonArrPop(String key, Class clazz, Path path, int index) { - return appendCommand(commandObjects.jsonArrPop(key, clazz, path, index)); - } - - @Override - public Response jsonArrLen(String key) { - return appendCommand(commandObjects.jsonArrLen(key)); - } - - @Override - public Response> jsonArrLen(String key, Path2 path) { - return appendCommand(commandObjects.jsonArrLen(key, path)); - } - - @Override - public Response jsonArrPop(String key, Class clazz) { - return appendCommand(commandObjects.jsonArrPop(key, clazz)); - } - - @Override - public Response> jsonArrPop(String key, Path2 path) { - return appendCommand(commandObjects.jsonArrPop(key, path)); - } - - @Override - public Response jsonArrPop(String key, Path path) { - return appendCommand(commandObjects.jsonArrPop(key, path)); - } - // RedisJSON commands - - // RedisTimeSeries commands - @Override - public Response tsCreate(String key) { - return appendCommand(commandObjects.tsCreate(key)); - } - - @Override - public Response tsCreate(String key, TSCreateParams createParams) { - return appendCommand(commandObjects.tsCreate(key, createParams)); - } - - @Override - public Response tsDel(String key, long fromTimestamp, long toTimestamp) { - return appendCommand(commandObjects.tsDel(key, fromTimestamp, toTimestamp)); - } - - @Override - public Response tsAlter(String key, TSAlterParams alterParams) { - return appendCommand(commandObjects.tsAlter(key, alterParams)); - } - - @Override - public Response tsAdd(String key, double value) { - return appendCommand(commandObjects.tsAdd(key, value)); - } - - @Override - public Response tsAdd(String key, long timestamp, double value) { - return appendCommand(commandObjects.tsAdd(key, timestamp, value)); - } - - @Override - public Response tsAdd(String key, long timestamp, double value, TSCreateParams createParams) { - return appendCommand(commandObjects.tsAdd(key, timestamp, value, createParams)); - } - - @Override - public Response> tsMAdd(Map.Entry... entries) { - return appendCommand(commandObjects.tsMAdd(entries)); - } - - @Override - public Response tsIncrBy(String key, double value) { - return appendCommand(commandObjects.tsIncrBy(key, value)); - } - - @Override - public Response tsIncrBy(String key, double value, long timestamp) { - return appendCommand(commandObjects.tsIncrBy(key, value, timestamp)); - } - - @Override - public Response tsDecrBy(String key, double value) { - return appendCommand(commandObjects.tsDecrBy(key, value)); - } - - @Override - public Response tsDecrBy(String key, double value, long timestamp) { - return appendCommand(commandObjects.tsDecrBy(key, value, timestamp)); - } - - @Override - public Response> tsRange(String key, long fromTimestamp, long toTimestamp) { - return appendCommand(commandObjects.tsRange(key, fromTimestamp, toTimestamp)); - } - - @Override - public Response> tsRange(String key, TSRangeParams rangeParams) { - return appendCommand(commandObjects.tsRange(key, rangeParams)); - } - - @Override - public Response> tsRevRange(String key, long fromTimestamp, long toTimestamp) { - return appendCommand(commandObjects.tsRevRange(key, fromTimestamp, toTimestamp)); - } - - @Override - public Response> tsRevRange(String key, TSRangeParams rangeParams) { - return appendCommand(commandObjects.tsRevRange(key, rangeParams)); - } - - @Override - public Response> tsMRange(long fromTimestamp, long toTimestamp, String... filters) { - return appendCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); - } - - @Override - public Response> tsMRange(TSMRangeParams multiRangeParams) { - return appendCommand(commandObjects.tsMRange(multiRangeParams)); - } - - @Override - public Response> tsMRevRange(long fromTimestamp, long toTimestamp, String... filters) { - return appendCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); - } - - @Override - public Response> tsMRevRange(TSMRangeParams multiRangeParams) { - return appendCommand(commandObjects.tsMRevRange(multiRangeParams)); - } - - @Override - public Response tsGet(String key) { - return appendCommand(commandObjects.tsGet(key)); - } - - @Override - public Response tsGet(String key, TSGetParams getParams) { - return appendCommand(commandObjects.tsGet(key, getParams)); - } - - @Override - public Response> tsMGet(TSMGetParams multiGetParams, String... filters) { - return appendCommand(commandObjects.tsMGet(multiGetParams, filters)); - } - - @Override - public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long timeBucket) { - return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); - } - - @Override - public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long bucketDuration, long alignTimestamp) { - return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, bucketDuration, alignTimestamp)); - } - - @Override - public Response tsDeleteRule(String sourceKey, String destKey) { - return appendCommand(commandObjects.tsDeleteRule(sourceKey, destKey)); - } - - @Override - public Response> tsQueryIndex(String... filters) { - return appendCommand(commandObjects.tsQueryIndex(filters)); - } - // RedisTimeSeries commands - - // RedisBloom commands - @Override - public Response bfReserve(String key, double errorRate, long capacity) { - return appendCommand(commandObjects.bfReserve(key, errorRate, capacity)); - } - - @Override - public Response bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams) { - return appendCommand(commandObjects.bfReserve(key, errorRate, capacity, reserveParams)); - } - - @Override - public Response bfAdd(String key, String item) { - return appendCommand(commandObjects.bfAdd(key, item)); - } - - @Override - public Response> bfMAdd(String key, String... items) { - return appendCommand(commandObjects.bfMAdd(key, items)); - } - - @Override - public Response> bfInsert(String key, String... items) { - return appendCommand(commandObjects.bfInsert(key, items)); - } - - @Override - public Response> bfInsert(String key, BFInsertParams insertParams, String... items) { - return appendCommand(commandObjects.bfInsert(key, insertParams, items)); - } - - @Override - public Response bfExists(String key, String item) { - return appendCommand(commandObjects.bfExists(key, item)); - } - - @Override - public Response> bfMExists(String key, String... items) { - return appendCommand(commandObjects.bfMExists(key, items)); - } - - @Override - public Response> bfScanDump(String key, long iterator) { - return appendCommand(commandObjects.bfScanDump(key, iterator)); - } - - @Override - public Response bfLoadChunk(String key, long iterator, byte[] data) { - return appendCommand(commandObjects.bfLoadChunk(key, iterator, data)); - } - - @Override - public Response bfCard(String key) { - return appendCommand(commandObjects.bfCard(key)); - } - - @Override - public Response> bfInfo(String key) { - return appendCommand(commandObjects.bfInfo(key)); - } - - @Override - public Response cfReserve(String key, long capacity) { - return appendCommand(commandObjects.cfReserve(key, capacity)); - } - - @Override - public Response cfReserve(String key, long capacity, CFReserveParams reserveParams) { - return appendCommand(commandObjects.cfReserve(key, capacity, reserveParams)); - } - - @Override - public Response cfAdd(String key, String item) { - return appendCommand(commandObjects.cfAdd(key, item)); - } - - @Override - public Response cfAddNx(String key, String item) { - return appendCommand(commandObjects.cfAddNx(key, item)); - } - - @Override - public Response> cfInsert(String key, String... items) { - return appendCommand(commandObjects.cfInsert(key, items)); - } - - @Override - public Response> cfInsert(String key, CFInsertParams insertParams, String... items) { - return appendCommand(commandObjects.cfInsert(key, insertParams, items)); - } - - @Override - public Response> cfInsertNx(String key, String... items) { - return appendCommand(commandObjects.cfInsertNx(key, items)); - } - - @Override - public Response> cfInsertNx(String key, CFInsertParams insertParams, String... items) { - return appendCommand(commandObjects.cfInsertNx(key, insertParams, items)); - } - - @Override - public Response cfExists(String key, String item) { - return appendCommand(commandObjects.cfExists(key, item)); - } - - @Override - public Response cfDel(String key, String item) { - return appendCommand(commandObjects.cfDel(key, item)); - } - - @Override - public Response cfCount(String key, String item) { - return appendCommand(commandObjects.cfCount(key, item)); - } - - @Override - public Response> cfScanDump(String key, long iterator) { - return appendCommand(commandObjects.cfScanDump(key, iterator)); - } - - @Override - public Response cfLoadChunk(String key, long iterator, byte[] data) { - return appendCommand(commandObjects.cfLoadChunk(key, iterator, data)); - } - - @Override - public Response> cfInfo(String key) { - return appendCommand(commandObjects.cfInfo(key)); - } - - @Override - public Response cmsInitByDim(String key, long width, long depth) { - return appendCommand(commandObjects.cmsInitByDim(key, width, depth)); - } - - @Override - public Response cmsInitByProb(String key, double error, double probability) { - return appendCommand(commandObjects.cmsInitByProb(key, error, probability)); - } - - @Override - public Response> cmsIncrBy(String key, Map itemIncrements) { - return appendCommand(commandObjects.cmsIncrBy(key, itemIncrements)); - } - - @Override - public Response> cmsQuery(String key, String... items) { - return appendCommand(commandObjects.cmsQuery(key, items)); - } - - @Override - public Response cmsMerge(String destKey, String... keys) { - return appendCommand(commandObjects.cmsMerge(destKey, keys)); - } - - @Override - public Response cmsMerge(String destKey, Map keysAndWeights) { - return appendCommand(commandObjects.cmsMerge(destKey, keysAndWeights)); - } - - @Override - public Response> cmsInfo(String key) { - return appendCommand(commandObjects.cmsInfo(key)); - } - - @Override - public Response topkReserve(String key, long topk) { - return appendCommand(commandObjects.topkReserve(key, topk)); - } - - @Override - public Response topkReserve(String key, long topk, long width, long depth, double decay) { - return appendCommand(commandObjects.topkReserve(key, topk, width, depth, decay)); - } - - @Override - public Response> topkAdd(String key, String... items) { - return appendCommand(commandObjects.topkAdd(key, items)); - } - - @Override - public Response> topkIncrBy(String key, Map itemIncrements) { - return appendCommand(commandObjects.topkIncrBy(key, itemIncrements)); - } - - @Override - public Response> topkQuery(String key, String... items) { - return appendCommand(commandObjects.topkQuery(key, items)); - } - - @Override - public Response> topkList(String key) { - return appendCommand(commandObjects.topkList(key)); - } - - @Override - public Response> topkInfo(String key) { - return appendCommand(commandObjects.topkInfo(key)); - } - - @Override - public Response tdigestCreate(String key) { - return appendCommand(commandObjects.tdigestCreate(key)); - } - - @Override - public Response tdigestCreate(String key, int compression) { - return appendCommand(commandObjects.tdigestCreate(key, compression)); - } - - @Override - public Response tdigestReset(String key) { - return appendCommand(commandObjects.tdigestReset(key)); - } - - @Override - public Response tdigestMerge(String destinationKey, String... sourceKeys) { - return appendCommand(commandObjects.tdigestMerge(destinationKey, sourceKeys)); - } - - @Override - public Response tdigestMerge(TDigestMergeParams mergeParams, String destinationKey, String... sourceKeys) { - return appendCommand(commandObjects.tdigestMerge(mergeParams, destinationKey, sourceKeys)); - } - - @Override - public Response> tdigestInfo(String key) { - return appendCommand(commandObjects.tdigestInfo(key)); - } - - @Override - public Response tdigestAdd(String key, double... values) { - return appendCommand(commandObjects.tdigestAdd(key, values)); - } - - @Override - public Response> tdigestCDF(String key, double... values) { - return appendCommand(commandObjects.tdigestCDF(key, values)); - } - - @Override - public Response> tdigestQuantile(String key, double... quantiles) { - return appendCommand(commandObjects.tdigestQuantile(key, quantiles)); - } - - @Override - public Response tdigestMin(String key) { - return appendCommand(commandObjects.tdigestMin(key)); - } - - @Override - public Response tdigestMax(String key) { - return appendCommand(commandObjects.tdigestMax(key)); - } - - @Override - public Response tdigestTrimmedMean(String key, double lowCutQuantile, double highCutQuantile) { - return appendCommand(commandObjects.tdigestTrimmedMean(key, lowCutQuantile, highCutQuantile)); - } - - @Override - public Response> tdigestRank(String key, double... values) { - return appendCommand(commandObjects.tdigestRank(key, values)); - } - - @Override - public Response> tdigestRevRank(String key, double... values) { - return appendCommand(commandObjects.tdigestRevRank(key, values)); - } - - @Override - public Response> tdigestByRank(String key, long... ranks) { - return appendCommand(commandObjects.tdigestByRank(key, ranks)); - } - - @Override - public Response> tdigestByRevRank(String key, long... ranks) { - return appendCommand(commandObjects.tdigestByRevRank(key, ranks)); - } - // RedisBloom commands - - // RedisGraph commands - @Override - public Response graphQuery(String name, String query) { - return appendCommand(graphCommandObjects.graphQuery(name, query)); - } - - @Override - public Response graphReadonlyQuery(String name, String query) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query)); - } - - @Override - public Response graphQuery(String name, String query, long timeout) { - return appendCommand(graphCommandObjects.graphQuery(name, query, timeout)); - } - - @Override - public Response graphReadonlyQuery(String name, String query, long timeout) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, timeout)); - } - - @Override - public Response graphQuery(String name, String query, Map params) { - return appendCommand(graphCommandObjects.graphQuery(name, query, params)); - } - - @Override - public Response graphReadonlyQuery(String name, String query, Map params) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, params)); - } - - @Override - public Response graphQuery(String name, String query, Map params, long timeout) { - return appendCommand(graphCommandObjects.graphQuery(name, query, params, timeout)); - } - - @Override - public Response graphReadonlyQuery(String name, String query, Map params, long timeout) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, params, timeout)); - } - - @Override - public Response graphDelete(String name) { - return appendCommand(graphCommandObjects.graphDelete(name)); - } - - @Override - public Response> graphProfile(String graphName, String query) { - return appendCommand(commandObjects.graphProfile(graphName, query)); - } - // RedisGraph commands - - public Response publish(String channel, String message) { - return appendCommand(commandObjects.publish(channel, message)); - } - - public Response publish(byte[] channel, byte[] message) { - return appendCommand(commandObjects.publish(channel, message)); - } - - public Response sendCommand(ProtocolCommand cmd, String... args) { - return sendCommand(new CommandArguments(cmd).addObjects((Object[]) args)); - } - - public Response sendCommand(ProtocolCommand cmd, byte[]... args) { - return sendCommand(new CommandArguments(cmd).addObjects((Object[]) args)); - } - - public Response sendCommand(CommandArguments args) { - return executeCommand(new CommandObject<>(args, BuilderFactory.RAW_OBJECT)); - } - - public Response executeCommand(CommandObject command) { - return appendCommand(command); - } - - public void setJsonObjectMapper(JsonObjectMapper jsonObjectMapper) { - this.commandObjects.setJsonObjectMapper(jsonObjectMapper); +/** + * @deprecated Use {@link AbstractPipeline}. + */ +@Deprecated +public abstract class PipelineBase extends AbstractPipeline { + + protected PipelineBase(CommandObjects commandObjects) { + super(commandObjects); } } diff --git a/src/main/java/redis/clients/jedis/PipeliningBase.java b/src/main/java/redis/clients/jedis/PipeliningBase.java new file mode 100644 index 0000000000..5c6cd45f07 --- /dev/null +++ b/src/main/java/redis/clients/jedis/PipeliningBase.java @@ -0,0 +1,4242 @@ +package redis.clients.jedis; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.json.JSONArray; + +import redis.clients.jedis.args.*; +import redis.clients.jedis.bloom.*; +import redis.clients.jedis.commands.PipelineBinaryCommands; +import redis.clients.jedis.commands.PipelineCommands; +import redis.clients.jedis.commands.ProtocolCommand; +import redis.clients.jedis.commands.RedisModulePipelineCommands; +import redis.clients.jedis.graph.GraphCommandObjects; +import redis.clients.jedis.graph.ResultSet; +import redis.clients.jedis.json.JsonSetParams; +import redis.clients.jedis.json.Path; +import redis.clients.jedis.json.Path2; +import redis.clients.jedis.json.JsonObjectMapper; +import redis.clients.jedis.params.*; +import redis.clients.jedis.resps.*; +import redis.clients.jedis.search.*; +import redis.clients.jedis.search.aggr.AggregationBuilder; +import redis.clients.jedis.search.aggr.AggregationResult; +import redis.clients.jedis.search.schemafields.SchemaField; +import redis.clients.jedis.timeseries.*; +import redis.clients.jedis.util.KeyValue; + +public abstract class PipeliningBase + implements PipelineCommands, PipelineBinaryCommands, RedisModulePipelineCommands { + + protected final CommandObjects commandObjects; + private GraphCommandObjects graphCommandObjects; + + protected PipeliningBase(CommandObjects commandObjects) { + this.commandObjects = commandObjects; + } + + /** + * Sub-classes must call this method, if graph commands are going to be used. + */ + protected final void setGraphCommands(GraphCommandObjects graphCommandObjects) { + this.graphCommandObjects = graphCommandObjects; + } + + protected abstract Response appendCommand(CommandObject commandObject); + + @Override + public Response exists(String key) { + return appendCommand(commandObjects.exists(key)); + } + + @Override + public Response exists(String... keys) { + return appendCommand(commandObjects.exists(keys)); + } + + @Override + public Response persist(String key) { + return appendCommand(commandObjects.persist(key)); + } + + @Override + public Response type(String key) { + return appendCommand(commandObjects.type(key)); + } + + @Override + public Response dump(String key) { + return appendCommand(commandObjects.dump(key)); + } + + @Override + public Response restore(String key, long ttl, byte[] serializedValue) { + return appendCommand(commandObjects.restore(key, ttl, serializedValue)); + } + + @Override + public Response restore(String key, long ttl, byte[] serializedValue, RestoreParams params) { + return appendCommand(commandObjects.restore(key, ttl, serializedValue, params)); + } + + @Override + public Response expire(String key, long seconds) { + return appendCommand(commandObjects.expire(key, seconds)); + } + + @Override + public Response expire(String key, long seconds, ExpiryOption expiryOption) { + return appendCommand(commandObjects.expire(key, seconds, expiryOption)); + } + + @Override + public Response pexpire(String key, long milliseconds) { + return appendCommand(commandObjects.pexpire(key, milliseconds)); + } + + @Override + public Response pexpire(String key, long milliseconds, ExpiryOption expiryOption) { + return appendCommand(commandObjects.pexpire(key, milliseconds, expiryOption)); + } + + @Override + public Response expireTime(String key) { + return appendCommand(commandObjects.expireTime(key)); + } + + @Override + public Response pexpireTime(String key) { + return appendCommand(commandObjects.pexpireTime(key)); + } + + @Override + public Response expireAt(String key, long unixTime) { + return appendCommand(commandObjects.expireAt(key, unixTime)); + } + + @Override + public Response expireAt(String key, long unixTime, ExpiryOption expiryOption) { + return appendCommand(commandObjects.expireAt(key, unixTime, expiryOption)); + } + + @Override + public Response pexpireAt(String key, long millisecondsTimestamp) { + return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp)); + } + + @Override + public Response pexpireAt(String key, long millisecondsTimestamp, ExpiryOption expiryOption) { + return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp, expiryOption)); + } + + @Override + public Response ttl(String key) { + return appendCommand(commandObjects.ttl(key)); + } + + @Override + public Response pttl(String key) { + return appendCommand(commandObjects.pttl(key)); + } + + @Override + public Response touch(String key) { + return appendCommand(commandObjects.touch(key)); + } + + @Override + public Response touch(String... keys) { + return appendCommand(commandObjects.touch(keys)); + } + + @Override + public Response> sort(String key) { + return appendCommand(commandObjects.sort(key)); + } + + @Override + public Response sort(String key, String dstKey) { + return appendCommand(commandObjects.sort(key, dstKey)); + } + + @Override + public Response> sort(String key, SortingParams sortingParams) { + return appendCommand(commandObjects.sort(key, sortingParams)); + } + + @Override + public Response sort(String key, SortingParams sortingParams, String dstKey) { + return appendCommand(commandObjects.sort(key, sortingParams, dstKey)); + } + + @Override + public Response> sortReadonly(String key, SortingParams sortingParams) { + return appendCommand(commandObjects.sortReadonly(key, sortingParams)); + } + + @Override + public Response del(String key) { + return appendCommand(commandObjects.del(key)); + } + + @Override + public Response del(String... keys) { + return appendCommand(commandObjects.del(keys)); + } + + @Override + public Response unlink(String key) { + return appendCommand(commandObjects.unlink(key)); + } + + @Override + public Response unlink(String... keys) { + return appendCommand(commandObjects.unlink(keys)); + } + + @Override + public Response copy(String srcKey, String dstKey, boolean replace) { + return appendCommand(commandObjects.copy(srcKey, dstKey, replace)); + } + + @Override + public Response rename(String oldkey, String newkey) { + return appendCommand(commandObjects.rename(oldkey, newkey)); + } + + @Override + public Response renamenx(String oldkey, String newkey) { + return appendCommand(commandObjects.renamenx(oldkey, newkey)); + } + + @Override + public Response memoryUsage(String key) { + return appendCommand(commandObjects.memoryUsage(key)); + } + + @Override + public Response memoryUsage(String key, int samples) { + return appendCommand(commandObjects.memoryUsage(key, samples)); + } + + @Override + public Response objectRefcount(String key) { + return appendCommand(commandObjects.objectRefcount(key)); + } + + @Override + public Response objectEncoding(String key) { + return appendCommand(commandObjects.objectEncoding(key)); + } + + @Override + public Response objectIdletime(String key) { + return appendCommand(commandObjects.objectIdletime(key)); + } + + @Override + public Response objectFreq(String key) { + return appendCommand(commandObjects.objectFreq(key)); + } + + @Override + public Response migrate(String host, int port, String key, int timeout) { + return appendCommand(commandObjects.migrate(host, port, key, timeout)); + } + + @Override + public Response migrate(String host, int port, int timeout, MigrateParams params, String... keys) { + return appendCommand(commandObjects.migrate(host, port, timeout, params, keys)); + } + + @Override + public Response> keys(String pattern) { + return appendCommand(commandObjects.keys(pattern)); + } + + @Override + public Response> scan(String cursor) { + return appendCommand(commandObjects.scan(cursor)); + } + + @Override + public Response> scan(String cursor, ScanParams params) { + return appendCommand(commandObjects.scan(cursor, params)); + } + + @Override + public Response> scan(String cursor, ScanParams params, String type) { + return appendCommand(commandObjects.scan(cursor, params, type)); + } + + @Override + public Response randomKey() { + return appendCommand(commandObjects.randomKey()); + } + + @Override + public Response get(String key) { + return appendCommand(commandObjects.get(key)); + } + + @Override + public Response setGet(String key, String value, SetParams params) { + return appendCommand(commandObjects.setGet(key, value, params)); + } + + @Override + public Response getDel(String key) { + return appendCommand(commandObjects.getDel(key)); + } + + @Override + public Response getEx(String key, GetExParams params) { + return appendCommand(commandObjects.getEx(key, params)); + } + + @Override + public Response setbit(String key, long offset, boolean value) { + return appendCommand(commandObjects.setbit(key, offset, value)); + } + + @Override + public Response getbit(String key, long offset) { + return appendCommand(commandObjects.getbit(key, offset)); + } + + @Override + public Response setrange(String key, long offset, String value) { + return appendCommand(commandObjects.setrange(key, offset, value)); + } + + @Override + public Response getrange(String key, long startOffset, long endOffset) { + return appendCommand(commandObjects.getrange(key, startOffset, endOffset)); + } + + @Override + public Response getSet(String key, String value) { + return appendCommand(commandObjects.getSet(key, value)); + } + + @Override + public Response setnx(String key, String value) { + return appendCommand(commandObjects.setnx(key, value)); + } + + @Override + public Response setex(String key, long seconds, String value) { + return appendCommand(commandObjects.setex(key, seconds, value)); + } + + @Override + public Response psetex(String key, long milliseconds, String value) { + return appendCommand(commandObjects.psetex(key, milliseconds, value)); + } + + @Override + public Response> mget(String... keys) { + return appendCommand(commandObjects.mget(keys)); + } + + @Override + public Response mset(String... keysvalues) { + return appendCommand(commandObjects.mset(keysvalues)); + } + + @Override + public Response msetnx(String... keysvalues) { + return appendCommand(commandObjects.msetnx(keysvalues)); + } + + @Override + public Response incr(String key) { + return appendCommand(commandObjects.incr(key)); + } + + @Override + public Response incrBy(String key, long increment) { + return appendCommand(commandObjects.incrBy(key, increment)); + } + + @Override + public Response incrByFloat(String key, double increment) { + return appendCommand(commandObjects.incrByFloat(key, increment)); + } + + @Override + public Response decr(String key) { + return appendCommand(commandObjects.decr(key)); + } + + @Override + public Response decrBy(String key, long decrement) { + return appendCommand(commandObjects.decrBy(key, decrement)); + } + + @Override + public Response append(String key, String value) { + return appendCommand(commandObjects.append(key, value)); + } + + @Override + public Response substr(String key, int start, int end) { + return appendCommand(commandObjects.substr(key, start, end)); + } + + @Override + public Response strlen(String key) { + return appendCommand(commandObjects.strlen(key)); + } + + @Override + public Response bitcount(String key) { + return appendCommand(commandObjects.bitcount(key)); + } + + @Override + public Response bitcount(String key, long start, long end) { + return appendCommand(commandObjects.bitcount(key, start, end)); + } + + @Override + public Response bitcount(String key, long start, long end, BitCountOption option) { + return appendCommand(commandObjects.bitcount(key, start, end, option)); + } + + @Override + public Response bitpos(String key, boolean value) { + return appendCommand(commandObjects.bitpos(key, value)); + } + + @Override + public Response bitpos(String key, boolean value, BitPosParams params) { + return appendCommand(commandObjects.bitpos(key, value, params)); + } + + @Override + public Response> bitfield(String key, String... arguments) { + return appendCommand(commandObjects.bitfield(key, arguments)); + } + + @Override + public Response> bitfieldReadonly(String key, String... arguments) { + return appendCommand(commandObjects.bitfieldReadonly(key, arguments)); + } + + @Override + public Response bitop(BitOP op, String destKey, String... srcKeys) { + return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); + } + + @Override + public Response lcs(String keyA, String keyB, LCSParams params) { + return appendCommand(commandObjects.lcs(keyA, keyB, params)); + } + + @Override + public Response set(String key, String value) { + return appendCommand(commandObjects.set(key, value)); + } + + @Override + public Response set(String key, String value, SetParams params) { + return appendCommand(commandObjects.set(key, value, params)); + } + + @Override + public Response rpush(String key, String... string) { + return appendCommand(commandObjects.rpush(key, string)); + + } + + @Override + public Response lpush(String key, String... string) { + return appendCommand(commandObjects.lpush(key, string)); + } + + @Override + public Response llen(String key) { + return appendCommand(commandObjects.llen(key)); + } + + @Override + public Response> lrange(String key, long start, long stop) { + return appendCommand(commandObjects.lrange(key, start, stop)); + } + + @Override + public Response ltrim(String key, long start, long stop) { + return appendCommand(commandObjects.ltrim(key, start, stop)); + } + + @Override + public Response lindex(String key, long index) { + return appendCommand(commandObjects.lindex(key, index)); + } + + @Override + public Response lset(String key, long index, String value) { + return appendCommand(commandObjects.lset(key, index, value)); + } + + @Override + public Response lrem(String key, long count, String value) { + return appendCommand(commandObjects.lrem(key, count, value)); + } + + @Override + public Response lpop(String key) { + return appendCommand(commandObjects.lpop(key)); + } + + @Override + public Response> lpop(String key, int count) { + return appendCommand(commandObjects.lpop(key, count)); + } + + @Override + public Response lpos(String key, String element) { + return appendCommand(commandObjects.lpos(key, element)); + } + + @Override + public Response lpos(String key, String element, LPosParams params) { + return appendCommand(commandObjects.lpos(key, element, params)); + } + + @Override + public Response> lpos(String key, String element, LPosParams params, long count) { + return appendCommand(commandObjects.lpos(key, element, params, count)); + } + + @Override + public Response rpop(String key) { + return appendCommand(commandObjects.rpop(key)); + } + + @Override + public Response> rpop(String key, int count) { + return appendCommand(commandObjects.rpop(key, count)); + } + + @Override + public Response linsert(String key, ListPosition where, String pivot, String value) { + return appendCommand(commandObjects.linsert(key, where, pivot, value)); + } + + @Override + public Response lpushx(String key, String... strings) { + return appendCommand(commandObjects.lpushx(key, strings)); + } + + @Override + public Response rpushx(String key, String... strings) { + return appendCommand(commandObjects.rpushx(key, strings)); + } + + @Override + public Response> blpop(int timeout, String key) { + return appendCommand(commandObjects.blpop(timeout, key)); + } + + @Override + public Response> blpop(double timeout, String key) { + return appendCommand(commandObjects.blpop(timeout, key)); + } + + @Override + public Response> brpop(int timeout, String key) { + return appendCommand(commandObjects.brpop(timeout, key)); + } + + @Override + public Response> brpop(double timeout, String key) { + return appendCommand(commandObjects.brpop(timeout, key)); + } + + @Override + public Response> blpop(int timeout, String... keys) { + return appendCommand(commandObjects.blpop(timeout, keys)); + } + + @Override + public Response> blpop(double timeout, String... keys) { + return appendCommand(commandObjects.blpop(timeout, keys)); + } + + @Override + public Response> brpop(int timeout, String... keys) { + return appendCommand(commandObjects.brpop(timeout, keys)); + } + + @Override + public Response> brpop(double timeout, String... keys) { + return appendCommand(commandObjects.brpop(timeout, keys)); + } + + @Override + public Response rpoplpush(String srcKey, String dstKey) { + return appendCommand(commandObjects.rpoplpush(srcKey, dstKey)); + } + + @Override + public Response brpoplpush(String source, String destination, int timeout) { + return appendCommand(commandObjects.brpoplpush(source, destination, timeout)); + } + + @Override + public Response lmove(String srcKey, String dstKey, ListDirection from, ListDirection to) { + return appendCommand(commandObjects.lmove(srcKey, dstKey, from, to)); + } + + @Override + public Response blmove(String srcKey, String dstKey, ListDirection from, ListDirection to, double timeout) { + return appendCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); + } + + @Override + public Response>> lmpop(ListDirection direction, String... keys) { + return appendCommand(commandObjects.lmpop(direction, keys)); + } + + @Override + public Response>> lmpop(ListDirection direction, int count, String... keys) { + return appendCommand(commandObjects.lmpop(direction, count, keys)); + } + + @Override + public Response>> blmpop(double timeout, ListDirection direction, String... keys) { + return appendCommand(commandObjects.blmpop(timeout, direction, keys)); + } + + @Override + public Response>> blmpop(double timeout, ListDirection direction, int count, String... keys) { + return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); + } + + @Override + public Response hset(String key, String field, String value) { + return appendCommand(commandObjects.hset(key, field, value)); + } + + @Override + public Response hset(String key, Map hash) { + return appendCommand(commandObjects.hset(key, hash)); + } + + @Override + public Response hget(String key, String field) { + return appendCommand(commandObjects.hget(key, field)); + } + + @Override + public Response hsetnx(String key, String field, String value) { + return appendCommand(commandObjects.hsetnx(key, field, value)); + } + + @Override + public Response hmset(String key, Map hash) { + return appendCommand(commandObjects.hmset(key, hash)); + } + + @Override + public Response> hmget(String key, String... fields) { + return appendCommand(commandObjects.hmget(key, fields)); + } + + @Override + public Response hincrBy(String key, String field, long value) { + return appendCommand(commandObjects.hincrBy(key, field, value)); + } + + @Override + public Response hincrByFloat(String key, String field, double value) { + return appendCommand(commandObjects.hincrByFloat(key, field, value)); + } + + @Override + public Response hexists(String key, String field) { + return appendCommand(commandObjects.hexists(key, field)); + } + + @Override + public Response hdel(String key, String... field) { + return appendCommand(commandObjects.hdel(key, field)); + } + + @Override + public Response hlen(String key) { + return appendCommand(commandObjects.hlen(key)); + } + + @Override + public Response> hkeys(String key) { + return appendCommand(commandObjects.hkeys(key)); + } + + @Override + public Response> hvals(String key) { + return appendCommand(commandObjects.hvals(key)); + } + + @Override + public Response> hgetAll(String key) { + return appendCommand(commandObjects.hgetAll(key)); + } + + @Override + public Response hrandfield(String key) { + return appendCommand(commandObjects.hrandfield(key)); + } + + @Override + public Response> hrandfield(String key, long count) { + return appendCommand(commandObjects.hrandfield(key, count)); + } + + @Override + public Response>> hrandfieldWithValues(String key, long count) { + return appendCommand(commandObjects.hrandfieldWithValues(key, count)); + } + + @Override + public Response>> hscan(String key, String cursor, ScanParams params) { + return appendCommand(commandObjects.hscan(key, cursor, params)); + } + + @Override + public Response hstrlen(String key, String field) { + return appendCommand(commandObjects.hstrlen(key, field)); + } + + @Override + public Response sadd(String key, String... members) { + return appendCommand(commandObjects.sadd(key, members)); + } + + @Override + public Response> smembers(String key) { + return appendCommand(commandObjects.smembers(key)); + } + + @Override + public Response srem(String key, String... members) { + return appendCommand(commandObjects.srem(key, members)); + } + + @Override + public Response spop(String key) { + return appendCommand(commandObjects.spop(key)); + } + + @Override + public Response> spop(String key, long count) { + return appendCommand(commandObjects.spop(key, count)); + } + + @Override + public Response scard(String key) { + return appendCommand(commandObjects.scard(key)); + } + + @Override + public Response sismember(String key, String member) { + return appendCommand(commandObjects.sismember(key, member)); + } + + @Override + public Response> smismember(String key, String... members) { + return appendCommand(commandObjects.smismember(key, members)); + } + + @Override + public Response srandmember(String key) { + return appendCommand(commandObjects.srandmember(key)); + } + + @Override + public Response> srandmember(String key, int count) { + return appendCommand(commandObjects.srandmember(key, count)); + } + + @Override + public Response> sscan(String key, String cursor, ScanParams params) { + return appendCommand(commandObjects.sscan(key, cursor, params)); + } + + @Override + public Response> sdiff(String... keys) { + return appendCommand(commandObjects.sdiff(keys)); + } + + @Override + public Response sdiffStore(String dstKey, String... keys) { + return appendCommand(commandObjects.sdiffstore(dstKey, keys)); + } + + @Override + public Response> sinter(String... keys) { + return appendCommand(commandObjects.sinter(keys)); + } + + @Override + public Response sinterstore(String dstKey, String... keys) { + return appendCommand(commandObjects.sinterstore(dstKey, keys)); + } + + @Override + public Response sintercard(String... keys) { + return appendCommand(commandObjects.sintercard(keys)); + } + + @Override + public Response sintercard(int limit, String... keys) { + return appendCommand(commandObjects.sintercard(limit, keys)); + } + + @Override + public Response> sunion(String... keys) { + return appendCommand(commandObjects.sunion(keys)); + } + + @Override + public Response sunionstore(String dstKey, String... keys) { + return appendCommand(commandObjects.sunionstore(dstKey, keys)); + } + + @Override + public Response smove(String srcKey, String dstKey, String member) { + return appendCommand(commandObjects.smove(srcKey, dstKey, member)); + } + + @Override + public Response zadd(String key, double score, String member) { + return appendCommand(commandObjects.zadd(key, score, member)); + } + + @Override + public Response zadd(String key, double score, String member, ZAddParams params) { + return appendCommand(commandObjects.zadd(key, score, member, params)); + } + + @Override + public Response zadd(String key, Map scoreMembers) { + return appendCommand(commandObjects.zadd(key, scoreMembers)); + } + + @Override + public Response zadd(String key, Map scoreMembers, ZAddParams params) { + return appendCommand(commandObjects.zadd(key, scoreMembers, params)); + } + + @Override + public Response zaddIncr(String key, double score, String member, ZAddParams params) { + return appendCommand(commandObjects.zaddIncr(key, score, member, params)); + } + + @Override + public Response zrem(String key, String... members) { + return appendCommand(commandObjects.zrem(key, members)); + } + + @Override + public Response zincrby(String key, double increment, String member) { + return appendCommand(commandObjects.zincrby(key, increment, member)); + } + + @Override + public Response zincrby(String key, double increment, String member, ZIncrByParams params) { + return appendCommand(commandObjects.zincrby(key, increment, member, params)); + } + + @Override + public Response zrank(String key, String member) { + return appendCommand(commandObjects.zrank(key, member)); + } + + @Override + public Response zrevrank(String key, String member) { + return appendCommand(commandObjects.zrevrank(key, member)); + } + + @Override + public Response> zrankWithScore(String key, String member) { + return appendCommand(commandObjects.zrankWithScore(key, member)); + } + + @Override + public Response> zrevrankWithScore(String key, String member) { + return appendCommand(commandObjects.zrevrankWithScore(key, member)); + } + + @Override + public Response> zrange(String key, long start, long stop) { + return appendCommand(commandObjects.zrange(key, start, stop)); + } + + @Override + public Response> zrevrange(String key, long start, long stop) { + return appendCommand(commandObjects.zrevrange(key, start, stop)); + } + + @Override + public Response> zrangeWithScores(String key, long start, long stop) { + return appendCommand(commandObjects.zrangeWithScores(key, start, stop)); + } + + @Override + public Response> zrevrangeWithScores(String key, long start, long stop) { + return appendCommand(commandObjects.zrevrangeWithScores(key, start, stop)); + } + + @Override + public Response zrandmember(String key) { + return appendCommand(commandObjects.zrandmember(key)); + } + + @Override + public Response> zrandmember(String key, long count) { + return appendCommand(commandObjects.zrandmember(key, count)); + } + + @Override + public Response> zrandmemberWithScores(String key, long count) { + return appendCommand(commandObjects.zrandmemberWithScores(key, count)); + } + + @Override + public Response zcard(String key) { + return appendCommand(commandObjects.zcard(key)); + } + + @Override + public Response zscore(String key, String member) { + return appendCommand(commandObjects.zscore(key, member)); + } + + @Override + public Response> zmscore(String key, String... members) { + return appendCommand(commandObjects.zmscore(key, members)); + } + + @Override + public Response zpopmax(String key) { + return appendCommand(commandObjects.zpopmax(key)); + } + + @Override + public Response> zpopmax(String key, int count) { + return appendCommand(commandObjects.zpopmax(key, count)); + } + + @Override + public Response zpopmin(String key) { + return appendCommand(commandObjects.zpopmin(key)); + } + + @Override + public Response> zpopmin(String key, int count) { + return appendCommand(commandObjects.zpopmin(key, count)); + } + + @Override + public Response zcount(String key, double min, double max) { + return appendCommand(commandObjects.zcount(key, min, max)); + } + + @Override + public Response zcount(String key, String min, String max) { + return appendCommand(commandObjects.zcount(key, min, max)); + } + + @Override + public Response> zrangeByScore(String key, double min, double max) { + return appendCommand(commandObjects.zrangeByScore(key, min, max)); + } + + @Override + public Response> zrangeByScore(String key, String min, String max) { + return appendCommand(commandObjects.zrangeByScore(key, min, max)); + } + + @Override + public Response> zrevrangeByScore(String key, double max, double min) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); + } + + @Override + public Response> zrangeByScore(String key, double min, double max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScore(String key, String max, String min) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); + } + + @Override + public Response> zrangeByScore(String key, String min, String max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScore(String key, double max, double min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); + } + + @Override + public Response> zrangeByScoreWithScores(String key, double min, double max) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); + } + + @Override + public Response> zrevrangeByScoreWithScores(String key, double max, double min) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); + } + + @Override + public Response> zrangeByScoreWithScores(String key, double min, double max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScore(String key, String max, String min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); + } + + @Override + public Response> zrangeByScoreWithScores(String key, String min, String max) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); + } + + @Override + public Response> zrevrangeByScoreWithScores(String key, String max, String min) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); + } + + @Override + public Response> zrangeByScoreWithScores(String key, String min, String max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); + } + + @Override + public Response> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); + } + + @Override + public Response> zrange(String key, ZRangeParams zRangeParams) { + return appendCommand(commandObjects.zrange(key, zRangeParams)); + } + + @Override + public Response> zrangeWithScores(String key, ZRangeParams zRangeParams) { + return appendCommand(commandObjects.zrangeWithScores(key, zRangeParams)); + } + + @Override + public Response zrangestore(String dest, String src, ZRangeParams zRangeParams) { + return appendCommand(commandObjects.zrangestore(dest, src, zRangeParams)); + } + + @Override + public Response zremrangeByRank(String key, long start, long stop) { + return appendCommand(commandObjects.zremrangeByRank(key, start, stop)); + } + + @Override + public Response zremrangeByScore(String key, double min, double max) { + return appendCommand(commandObjects.zremrangeByScore(key, min, max)); + } + + @Override + public Response zremrangeByScore(String key, String min, String max) { + return appendCommand(commandObjects.zremrangeByScore(key, min, max)); + } + + @Override + public Response zlexcount(String key, String min, String max) { + return appendCommand(commandObjects.zlexcount(key, min, max)); + } + + @Override + public Response> zrangeByLex(String key, String min, String max) { + return appendCommand(commandObjects.zrangeByLex(key, min, max)); + } + + @Override + public Response> zrangeByLex(String key, String min, String max, int offset, int count) { + return appendCommand(commandObjects.zrangeByLex(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByLex(String key, String max, String min) { + return appendCommand(commandObjects.zrevrangeByLex(key, max, min)); + } + + @Override + public Response> zrevrangeByLex(String key, String max, String min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByLex(key, max, min, offset, count)); + } + + @Override + public Response zremrangeByLex(String key, String min, String max) { + return appendCommand(commandObjects.zremrangeByLex(key, min, max)); + } + + @Override + public Response> zscan(String key, String cursor, ScanParams params) { + return appendCommand(commandObjects.zscan(key, cursor, params)); + } + + @Override + public Response> bzpopmax(double timeout, String... keys) { + return appendCommand(commandObjects.bzpopmax(timeout, keys)); + } + + @Override + public Response> bzpopmin(double timeout, String... keys) { + return appendCommand(commandObjects.bzpopmin(timeout, keys)); + } + + @Override + public Response>> zmpop(SortedSetOption option, String... keys) { + return appendCommand(commandObjects.zmpop(option, keys)); + } + + @Override + public Response>> zmpop(SortedSetOption option, int count, String... keys) { + return appendCommand(commandObjects.zmpop(option, count, keys)); + } + + @Override + public Response>> bzmpop(double timeout, SortedSetOption option, String... keys) { + return appendCommand(commandObjects.bzmpop(timeout, option, keys)); + } + + @Override + public Response>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { + return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); + } + + @Override + public Response> zdiff(String... keys) { + return appendCommand(commandObjects.zdiff(keys)); + } + + @Override + public Response> zdiffWithScores(String... keys) { + return appendCommand(commandObjects.zdiffWithScores(keys)); + } + + @Override + @Deprecated + public Response zdiffStore(String dstKey, String... keys) { + return appendCommand(commandObjects.zdiffStore(dstKey, keys)); + } + + @Override + public Response zdiffstore(String dstKey, String... keys) { + return appendCommand(commandObjects.zdiffstore(dstKey, keys)); + } + + @Override + public Response zinterstore(String dstKey, String... sets) { + return appendCommand(commandObjects.zinterstore(dstKey, sets)); + } + + @Override + public Response zinterstore(String dstKey, ZParams params, String... sets) { + return appendCommand(commandObjects.zinterstore(dstKey, params, sets)); + } + + @Override + public Response> zinter(ZParams params, String... keys) { + return appendCommand(commandObjects.zinter(params, keys)); + } + + @Override + public Response> zinterWithScores(ZParams params, String... keys) { + return appendCommand(commandObjects.zinterWithScores(params, keys)); + } + + @Override + public Response zintercard(String... keys) { + return appendCommand(commandObjects.zintercard(keys)); + } + + @Override + public Response zintercard(long limit, String... keys) { + return appendCommand(commandObjects.zintercard(limit, keys)); + } + + @Override + public Response> zunion(ZParams params, String... keys) { + return appendCommand(commandObjects.zunion(params, keys)); + } + + @Override + public Response> zunionWithScores(ZParams params, String... keys) { + return appendCommand(commandObjects.zunionWithScores(params, keys)); + } + + @Override + public Response zunionstore(String dstKey, String... sets) { + return appendCommand(commandObjects.zunionstore(dstKey, sets)); + } + + @Override + public Response zunionstore(String dstKey, ZParams params, String... sets) { + return appendCommand(commandObjects.zunionstore(dstKey, params, sets)); + } + + @Override + public Response geoadd(String key, double longitude, double latitude, String member) { + return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); + } + + @Override + public Response geoadd(String key, Map memberCoordinateMap) { + return appendCommand(commandObjects.geoadd(key, memberCoordinateMap)); + } + + @Override + public Response geoadd(String key, GeoAddParams params, Map memberCoordinateMap) { + return appendCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); + } + + @Override + public Response geodist(String key, String member1, String member2) { + return appendCommand(commandObjects.geodist(key, member1, member2)); + } + + @Override + public Response geodist(String key, String member1, String member2, GeoUnit unit) { + return appendCommand(commandObjects.geodist(key, member1, member2, unit)); + } + + @Override + public Response> geohash(String key, String... members) { + return appendCommand(commandObjects.geohash(key, members)); + } + + @Override + public Response> geopos(String key, String... members) { + return appendCommand(commandObjects.geopos(key, members)); + } + + @Override + public Response> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); + } + + @Override + public Response> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); + } + + @Override + public Response> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); + } + + @Override + public Response> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); + } + + @Override + public Response> georadiusByMember(String key, String member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit)); + } + + @Override + public Response> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); + } + + @Override + public Response> georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); + } + + @Override + public Response> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); + } + + @Override + public Response georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return appendCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); + } + + @Override + public Response georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return appendCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); + } + + @Override + public Response> geosearch(String key, String member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, member, radius, unit)); + } + + @Override + public Response> geosearch(String key, GeoCoordinate coord, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, coord, radius, unit)); + } + + @Override + public Response> geosearch(String key, String member, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, member, width, height, unit)); + } + + @Override + public Response> geosearch(String key, GeoCoordinate coord, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, coord, width, height, unit)); + } + + @Override + public Response> geosearch(String key, GeoSearchParam params) { + return appendCommand(commandObjects.geosearch(key, params)); + } + + @Override + public Response geosearchStore(String dest, String src, String member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, member, radius, unit)); + } + + @Override + public Response geosearchStore(String dest, String src, GeoCoordinate coord, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); + } + + @Override + public Response geosearchStore(String dest, String src, String member, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); + } + + @Override + public Response geosearchStore(String dest, String src, GeoCoordinate coord, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); + } + + @Override + public Response geosearchStore(String dest, String src, GeoSearchParam params) { + return appendCommand(commandObjects.geosearchStore(dest, src, params)); + } + + @Override + public Response geosearchStoreStoreDist(String dest, String src, GeoSearchParam params) { + return appendCommand(commandObjects.geosearchStoreStoreDist(dest, src, params)); + } + + @Override + public Response pfadd(String key, String... elements) { + return appendCommand(commandObjects.pfadd(key, elements)); + } + + @Override + public Response pfmerge(String destkey, String... sourcekeys) { + return appendCommand(commandObjects.pfmerge(destkey, sourcekeys)); + } + + @Override + public Response pfcount(String key) { + return appendCommand(commandObjects.pfcount(key)); + } + + @Override + public Response pfcount(String... keys) { + return appendCommand(commandObjects.pfcount(keys)); + } + + @Override + public Response xadd(String key, StreamEntryID id, Map hash) { + return appendCommand(commandObjects.xadd(key, id, hash)); + } + + @Override + public Response xadd(String key, XAddParams params, Map hash) { + return appendCommand(commandObjects.xadd(key, params, hash)); + } + + @Override + public Response xlen(String key) { + return appendCommand(commandObjects.xlen(key)); + } + + @Override + public Response> xrange(String key, StreamEntryID start, StreamEntryID end) { + return appendCommand(commandObjects.xrange(key, start, end)); + } + + @Override + public Response> xrange(String key, StreamEntryID start, StreamEntryID end, int count) { + return appendCommand(commandObjects.xrange(key, start, end, count)); + } + + @Override + public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start) { + return appendCommand(commandObjects.xrevrange(key, end, start)); + } + + @Override + public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count) { + return appendCommand(commandObjects.xrevrange(key, end, start, count)); + } + + @Override + public Response> xrange(String key, String start, String end) { + return appendCommand(commandObjects.xrange(key, start, end)); + } + + @Override + public Response> xrange(String key, String start, String end, int count) { + return appendCommand(commandObjects.xrange(key, start, end, count)); + } + + @Override + public Response> xrevrange(String key, String end, String start) { + return appendCommand(commandObjects.xrevrange(key, end, start)); + } + + @Override + public Response> xrevrange(String key, String end, String start, int count) { + return appendCommand(commandObjects.xrevrange(key, end, start, count)); + } + + @Override + public Response xack(String key, String group, StreamEntryID... ids) { + return appendCommand(commandObjects.xack(key, group, ids)); + } + + @Override + public Response xgroupCreate(String key, String groupName, StreamEntryID id, boolean makeStream) { + return appendCommand(commandObjects.xgroupCreate(key, groupName, id, makeStream)); + } + + @Override + public Response xgroupSetID(String key, String groupName, StreamEntryID id) { + return appendCommand(commandObjects.xgroupSetID(key, groupName, id)); + } + + @Override + public Response xgroupDestroy(String key, String groupName) { + return appendCommand(commandObjects.xgroupDestroy(key, groupName)); + } + + @Override + public Response xgroupCreateConsumer(String key, String groupName, String consumerName) { + return appendCommand(commandObjects.xgroupCreateConsumer(key, groupName, consumerName)); + } + + @Override + public Response xgroupDelConsumer(String key, String groupName, String consumerName) { + return appendCommand(commandObjects.xgroupDelConsumer(key, groupName, consumerName)); + } + + @Override + public Response xpending(String key, String groupName) { + return appendCommand(commandObjects.xpending(key, groupName)); + } + + @Override + public Response> xpending(String key, String groupName, XPendingParams params) { + return appendCommand(commandObjects.xpending(key, groupName, params)); + } + + @Override + public Response xdel(String key, StreamEntryID... ids) { + return appendCommand(commandObjects.xdel(key, ids)); + } + + @Override + public Response xtrim(String key, long maxLen, boolean approximate) { + return appendCommand(commandObjects.xtrim(key, maxLen, approximate)); + } + + @Override + public Response xtrim(String key, XTrimParams params) { + return appendCommand(commandObjects.xtrim(key, params)); + } + + @Override + public Response> xclaim(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { + return appendCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); + } + + @Override + public Response> xclaimJustId(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { + return appendCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); + } + + @Override + public Response>> xautoclaim(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { + return appendCommand(commandObjects.xautoclaim(key, group, consumerName, minIdleTime, start, params)); + } + + @Override + public Response>> xautoclaimJustId(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { + return appendCommand(commandObjects.xautoclaimJustId(key, group, consumerName, minIdleTime, start, params)); + } + + @Override + public Response xinfoStream(String key) { + return appendCommand(commandObjects.xinfoStream(key)); + } + + @Override + public Response xinfoStreamFull(String key) { + return appendCommand(commandObjects.xinfoStreamFull(key)); + } + + @Override + public Response xinfoStreamFull(String key, int count) { + return appendCommand(commandObjects.xinfoStreamFull(key, count)); + } + + @Override + public Response> xinfoGroups(String key) { + return appendCommand(commandObjects.xinfoGroups(key)); + } + + @Override + public Response> xinfoConsumers(String key, String group) { + return appendCommand(commandObjects.xinfoConsumers(key, group)); + } + + @Override + public Response> xinfoConsumers2(String key, String group) { + return appendCommand(commandObjects.xinfoConsumers2(key, group)); + } + + @Override + public Response>>> xread(XReadParams xReadParams, Map streams) { + return appendCommand(commandObjects.xread(xReadParams, streams)); + } + + @Override + public Response>>> xreadGroup(String groupName, String consumer, XReadGroupParams xReadGroupParams, Map streams) { + return appendCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); + } + + @Override + public Response eval(String script) { + return appendCommand(commandObjects.eval(script)); + } + + @Override + public Response eval(String script, int keyCount, String... params) { + return appendCommand(commandObjects.eval(script, keyCount, params)); + } + + @Override + public Response eval(String script, List keys, List args) { + return appendCommand(commandObjects.eval(script, keys, args)); + } + + @Override + public Response evalReadonly(String script, List keys, List args) { + return appendCommand(commandObjects.evalReadonly(script, keys, args)); + } + + @Override + public Response evalsha(String sha1) { + return appendCommand(commandObjects.evalsha(sha1)); + } + + @Override + public Response evalsha(String sha1, int keyCount, String... params) { + return appendCommand(commandObjects.evalsha(sha1, keyCount, params)); + } + + @Override + public Response evalsha(String sha1, List keys, List args) { + return appendCommand(commandObjects.evalsha(sha1, keys, args)); + } + + @Override + public Response evalshaReadonly(String sha1, List keys, List args) { + return appendCommand(commandObjects.evalshaReadonly(sha1, keys, args)); + } + + @Override + public Response waitReplicas(String sampleKey, int replicas, long timeout) { + return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); + } + + @Override + public Response> waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) { + return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); + } + + @Override + public Response eval(String script, String sampleKey) { + return appendCommand(commandObjects.eval(script, sampleKey)); + } + + @Override + public Response evalsha(String sha1, String sampleKey) { + return appendCommand(commandObjects.evalsha(sha1, sampleKey)); + } + + @Override + public Response> scriptExists(String sampleKey, String... sha1) { + return appendCommand(commandObjects.scriptExists(sampleKey, sha1)); + } + + @Override + public Response scriptLoad(String script, String sampleKey) { + return appendCommand(commandObjects.scriptLoad(script, sampleKey)); + } + + @Override + public Response scriptFlush(String sampleKey) { + return appendCommand(commandObjects.scriptFlush(sampleKey)); + } + + @Override + public Response scriptFlush(String sampleKey, FlushMode flushMode) { + return appendCommand(commandObjects.scriptFlush(sampleKey, flushMode)); + } + + @Override + public Response scriptKill(String sampleKey) { + return appendCommand(commandObjects.scriptKill(sampleKey)); + } + + @Override + public Response fcall(byte[] name, List keys, List args) { + return appendCommand(commandObjects.fcall(name, keys, args)); + } + + @Override + public Response fcall(String name, List keys, List args) { + return appendCommand(commandObjects.fcall(name, keys, args)); + } + + @Override + public Response fcallReadonly(byte[] name, List keys, List args) { + return appendCommand(commandObjects.fcallReadonly(name, keys, args)); + } + + @Override + public Response fcallReadonly(String name, List keys, List args) { + return appendCommand(commandObjects.fcallReadonly(name, keys, args)); + } + + @Override + public Response functionDelete(byte[] libraryName) { + return appendCommand(commandObjects.functionDelete(libraryName)); + } + + @Override + public Response functionDelete(String libraryName) { + return appendCommand(commandObjects.functionDelete(libraryName)); + } + + @Override + public Response functionDump() { + return appendCommand(commandObjects.functionDump()); + } + + @Override + public Response> functionList(String libraryNamePattern) { + return appendCommand(commandObjects.functionList(libraryNamePattern)); + } + + @Override + public Response> functionList() { + return appendCommand(commandObjects.functionList()); + } + + @Override + public Response> functionListWithCode(String libraryNamePattern) { + return appendCommand(commandObjects.functionListWithCode(libraryNamePattern)); + } + + @Override + public Response> functionListWithCode() { + return appendCommand(commandObjects.functionListWithCode()); + } + + @Override + public Response> functionListBinary() { + return appendCommand(commandObjects.functionListBinary()); + } + + @Override + public Response> functionList(final byte[] libraryNamePattern) { + return appendCommand(commandObjects.functionList(libraryNamePattern)); + } + + @Override + public Response> functionListWithCodeBinary() { + return appendCommand(commandObjects.functionListWithCodeBinary()); + } + + @Override + public Response> functionListWithCode(final byte[] libraryNamePattern) { + return appendCommand(commandObjects.functionListWithCode(libraryNamePattern)); + } + + @Override + public Response functionLoad(byte[] functionCode) { + return appendCommand(commandObjects.functionLoad(functionCode)); + } + + @Override + public Response functionLoad(String functionCode) { + return appendCommand(commandObjects.functionLoad(functionCode)); + } + + @Override + public Response functionLoadReplace(byte[] functionCode) { + return appendCommand(commandObjects.functionLoadReplace(functionCode)); + } + + @Override + public Response functionLoadReplace(String functionCode) { + return appendCommand(commandObjects.functionLoadReplace(functionCode)); + } + + @Override + public Response functionRestore(byte[] serializedValue) { + return appendCommand(commandObjects.functionRestore(serializedValue)); + } + + @Override + public Response functionRestore(byte[] serializedValue, FunctionRestorePolicy policy) { + return appendCommand(commandObjects.functionRestore(serializedValue, policy)); + } + + @Override + public Response functionFlush() { + return appendCommand(commandObjects.functionFlush()); + } + + @Override + public Response functionFlush(FlushMode mode) { + return appendCommand(commandObjects.functionFlush(mode)); + } + + @Override + public Response functionKill() { + return appendCommand(commandObjects.functionKill()); + } + + @Override + public Response functionStats() { + return appendCommand(commandObjects.functionStats()); + } + + @Override + public Response functionStatsBinary() { + return appendCommand(commandObjects.functionStatsBinary()); + } + + @Override + public Response geoadd(byte[] key, double longitude, double latitude, byte[] member) { + return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); + } + + @Override + public Response geoadd(byte[] key, Map memberCoordinateMap) { + return appendCommand(commandObjects.geoadd(key, memberCoordinateMap)); + } + + @Override + public Response geoadd(byte[] key, GeoAddParams params, Map memberCoordinateMap) { + return appendCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); + } + + @Override + public Response geodist(byte[] key, byte[] member1, byte[] member2) { + return appendCommand(commandObjects.geodist(key, member1, member2)); + } + + @Override + public Response geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit) { + return appendCommand(commandObjects.geodist(key, member1, member2, unit)); + } + + @Override + public Response> geohash(byte[] key, byte[]... members) { + return appendCommand(commandObjects.geohash(key, members)); + } + + @Override + public Response> geopos(byte[] key, byte[]... members) { + return appendCommand(commandObjects.geopos(key, members)); + } + + @Override + public Response> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); + } + + @Override + public Response> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); + } + + @Override + public Response> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); + } + + @Override + public Response> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); + } + + @Override + public Response> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit)); + } + + @Override + public Response> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); + } + + @Override + public Response> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); + } + + @Override + public Response> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { + return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); + } + + @Override + public Response georadiusStore(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return appendCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); + } + + @Override + public Response georadiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return appendCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); + } + + @Override + public Response> geosearch(byte[] key, byte[] member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, member, radius, unit)); + } + + @Override + public Response> geosearch(byte[] key, GeoCoordinate coord, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, coord, radius, unit)); + } + + @Override + public Response> geosearch(byte[] key, byte[] member, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, member, width, height, unit)); + } + + @Override + public Response> geosearch(byte[] key, GeoCoordinate coord, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearch(key, coord, width, height, unit)); + } + + @Override + public Response> geosearch(byte[] key, GeoSearchParam params) { + return appendCommand(commandObjects.geosearch(key, params)); + } + + @Override + public Response geosearchStore(byte[] dest, byte[] src, byte[] member, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, member, radius, unit)); + } + + @Override + public Response geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double radius, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); + } + + @Override + public Response geosearchStore(byte[] dest, byte[] src, byte[] member, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); + } + + @Override + public Response geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double width, double height, GeoUnit unit) { + return appendCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); + } + + @Override + public Response geosearchStore(byte[] dest, byte[] src, GeoSearchParam params) { + return appendCommand(commandObjects.geosearchStore(dest, src, params)); + } + + @Override + public Response geosearchStoreStoreDist(byte[] dest, byte[] src, GeoSearchParam params) { + return appendCommand(commandObjects.geosearchStoreStoreDist(dest, src, params)); + } + + @Override + public Response hset(byte[] key, byte[] field, byte[] value) { + return appendCommand(commandObjects.hset(key, field, value)); + } + + @Override + public Response hset(byte[] key, Map hash) { + return appendCommand(commandObjects.hset(key, hash)); + } + + @Override + public Response hget(byte[] key, byte[] field) { + return appendCommand(commandObjects.hget(key, field)); + } + + @Override + public Response hsetnx(byte[] key, byte[] field, byte[] value) { + return appendCommand(commandObjects.hsetnx(key, field, value)); + } + + @Override + public Response hmset(byte[] key, Map hash) { + return appendCommand(commandObjects.hmset(key, hash)); + } + + @Override + public Response> hmget(byte[] key, byte[]... fields) { + return appendCommand(commandObjects.hmget(key, fields)); + } + + @Override + public Response hincrBy(byte[] key, byte[] field, long value) { + return appendCommand(commandObjects.hincrBy(key, field, value)); + } + + @Override + public Response hincrByFloat(byte[] key, byte[] field, double value) { + return appendCommand(commandObjects.hincrByFloat(key, field, value)); + } + + @Override + public Response hexists(byte[] key, byte[] field) { + return appendCommand(commandObjects.hexists(key, field)); + } + + @Override + public Response hdel(byte[] key, byte[]... field) { + return appendCommand(commandObjects.hdel(key, field)); + } + + @Override + public Response hlen(byte[] key) { + return appendCommand(commandObjects.hlen(key)); + } + + @Override + public Response> hkeys(byte[] key) { + return appendCommand(commandObjects.hkeys(key)); + } + + @Override + public Response> hvals(byte[] key) { + return appendCommand(commandObjects.hvals(key)); + } + + @Override + public Response> hgetAll(byte[] key) { + return appendCommand(commandObjects.hgetAll(key)); + } + + @Override + public Response hrandfield(byte[] key) { + return appendCommand(commandObjects.hrandfield(key)); + } + + @Override + public Response> hrandfield(byte[] key, long count) { + return appendCommand(commandObjects.hrandfield(key, count)); + } + + @Override + public Response>> hrandfieldWithValues(byte[] key, long count) { + return appendCommand(commandObjects.hrandfieldWithValues(key, count)); + } + + @Override + public Response>> hscan(byte[] key, byte[] cursor, ScanParams params) { + return appendCommand(commandObjects.hscan(key, cursor, params)); + } + + @Override + public Response hstrlen(byte[] key, byte[] field) { + return appendCommand(commandObjects.hstrlen(key, field)); + } + + @Override + public Response pfadd(byte[] key, byte[]... elements) { + return appendCommand(commandObjects.pfadd(key, elements)); + } + + @Override + public Response pfmerge(byte[] destkey, byte[]... sourcekeys) { + return appendCommand(commandObjects.pfmerge(destkey, sourcekeys)); + } + + @Override + public Response pfcount(byte[] key) { + return appendCommand(commandObjects.pfcount(key)); + } + + @Override + public Response pfcount(byte[]... keys) { + return appendCommand(commandObjects.pfcount(keys)); + } + + @Override + public Response exists(byte[] key) { + return appendCommand(commandObjects.exists(key)); + } + + @Override + public Response exists(byte[]... keys) { + return appendCommand(commandObjects.exists(keys)); + } + + @Override + public Response persist(byte[] key) { + return appendCommand(commandObjects.persist(key)); + } + + @Override + public Response type(byte[] key) { + return appendCommand(commandObjects.type(key)); + } + + @Override + public Response dump(byte[] key) { + return appendCommand(commandObjects.dump(key)); + } + + @Override + public Response restore(byte[] key, long ttl, byte[] serializedValue) { + return appendCommand(commandObjects.restore(key, ttl, serializedValue)); + } + + @Override + public Response restore(byte[] key, long ttl, byte[] serializedValue, RestoreParams params) { + return appendCommand(commandObjects.restore(key, ttl, serializedValue, params)); + } + + @Override + public Response expire(byte[] key, long seconds) { + return appendCommand(commandObjects.expire(key, seconds)); + } + + @Override + public Response expire(byte[] key, long seconds, ExpiryOption expiryOption) { + return appendCommand(commandObjects.expire(key, seconds, expiryOption)); + } + + @Override + public Response pexpire(byte[] key, long milliseconds) { + return appendCommand(commandObjects.pexpire(key, milliseconds)); + } + + @Override + public Response pexpire(byte[] key, long milliseconds, ExpiryOption expiryOption) { + return appendCommand(commandObjects.pexpire(key, milliseconds, expiryOption)); + } + + @Override + public Response expireTime(byte[] key) { + return appendCommand(commandObjects.expireTime(key)); + } + + @Override + public Response pexpireTime(byte[] key) { + return appendCommand(commandObjects.pexpireTime(key)); + } + + @Override + public Response expireAt(byte[] key, long unixTime) { + return appendCommand(commandObjects.expireAt(key, unixTime)); + } + + @Override + public Response expireAt(byte[] key, long unixTime, ExpiryOption expiryOption) { + return appendCommand(commandObjects.expireAt(key, unixTime)); + } + + @Override + public Response pexpireAt(byte[] key, long millisecondsTimestamp) { + return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp)); + } + + @Override + public Response pexpireAt(byte[] key, long millisecondsTimestamp, ExpiryOption expiryOption) { + return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp, expiryOption)); + } + + @Override + public Response ttl(byte[] key) { + return appendCommand(commandObjects.ttl(key)); + } + + @Override + public Response pttl(byte[] key) { + return appendCommand(commandObjects.pttl(key)); + } + + @Override + public Response touch(byte[] key) { + return appendCommand(commandObjects.touch(key)); + } + + @Override + public Response touch(byte[]... keys) { + return appendCommand(commandObjects.touch(keys)); + } + + @Override + public Response> sort(byte[] key) { + return appendCommand(commandObjects.sort(key)); + } + + @Override + public Response> sort(byte[] key, SortingParams sortingParams) { + return appendCommand(commandObjects.sort(key, sortingParams)); + } + + @Override + public Response> sortReadonly(byte[] key, SortingParams sortingParams) { + return appendCommand(commandObjects.sortReadonly(key, sortingParams)); + } + + @Override + public Response del(byte[] key) { + return appendCommand(commandObjects.del(key)); + } + + @Override + public Response del(byte[]... keys) { + return appendCommand(commandObjects.del(keys)); + } + + @Override + public Response unlink(byte[] key) { + return appendCommand(commandObjects.unlink(key)); + } + + @Override + public Response unlink(byte[]... keys) { + return appendCommand(commandObjects.unlink(keys)); + } + + @Override + public Response copy(byte[] srcKey, byte[] dstKey, boolean replace) { + return appendCommand(commandObjects.copy(srcKey, dstKey, replace)); + } + + @Override + public Response rename(byte[] oldkey, byte[] newkey) { + return appendCommand(commandObjects.rename(oldkey, newkey)); + } + + @Override + public Response renamenx(byte[] oldkey, byte[] newkey) { + return appendCommand(commandObjects.renamenx(oldkey, newkey)); + } + + @Override + public Response sort(byte[] key, SortingParams sortingParams, byte[] dstkey) { + return appendCommand(commandObjects.sort(key, sortingParams, dstkey)); + } + + @Override + public Response sort(byte[] key, byte[] dstkey) { + return appendCommand(commandObjects.sort(key, dstkey)); + } + + @Override + public Response memoryUsage(byte[] key) { + return appendCommand(commandObjects.memoryUsage(key)); + } + + @Override + public Response memoryUsage(byte[] key, int samples) { + return appendCommand(commandObjects.memoryUsage(key, samples)); + } + + @Override + public Response objectRefcount(byte[] key) { + return appendCommand(commandObjects.objectRefcount(key)); + } + + @Override + public Response objectEncoding(byte[] key) { + return appendCommand(commandObjects.objectEncoding(key)); + } + + @Override + public Response objectIdletime(byte[] key) { + return appendCommand(commandObjects.objectIdletime(key)); + } + + @Override + public Response objectFreq(byte[] key) { + return appendCommand(commandObjects.objectFreq(key)); + } + + @Override + public Response migrate(String host, int port, byte[] key, int timeout) { + return appendCommand(commandObjects.migrate(host, port, key, timeout)); + } + + @Override + public Response migrate(String host, int port, int timeout, MigrateParams params, byte[]... keys) { + return appendCommand(commandObjects.migrate(host, port, timeout, params, keys)); + } + + @Override + public Response> keys(byte[] pattern) { + return appendCommand(commandObjects.keys(pattern)); + } + + @Override + public Response> scan(byte[] cursor) { + return appendCommand(commandObjects.scan(cursor)); + } + + @Override + public Response> scan(byte[] cursor, ScanParams params) { + return appendCommand(commandObjects.scan(cursor, params)); + } + + @Override + public Response> scan(byte[] cursor, ScanParams params, byte[] type) { + return appendCommand(commandObjects.scan(cursor, params, type)); + } + + @Override + public Response randomBinaryKey() { + return appendCommand(commandObjects.randomBinaryKey()); + } + + @Override + public Response rpush(byte[] key, byte[]... args) { + return appendCommand(commandObjects.rpush(key, args)); + } + + @Override + public Response lpush(byte[] key, byte[]... args) { + return appendCommand(commandObjects.lpush(key, args)); + } + + @Override + public Response llen(byte[] key) { + return appendCommand(commandObjects.llen(key)); + } + + @Override + public Response> lrange(byte[] key, long start, long stop) { + return appendCommand(commandObjects.lrange(key, start, stop)); + } + + @Override + public Response ltrim(byte[] key, long start, long stop) { + return appendCommand(commandObjects.ltrim(key, start, stop)); + } + + @Override + public Response lindex(byte[] key, long index) { + return appendCommand(commandObjects.lindex(key, index)); + } + + @Override + public Response lset(byte[] key, long index, byte[] value) { + return appendCommand(commandObjects.lset(key, index, value)); + } + + @Override + public Response lrem(byte[] key, long count, byte[] value) { + return appendCommand(commandObjects.lrem(key, count, value)); + } + + @Override + public Response lpop(byte[] key) { + return appendCommand(commandObjects.lpop(key)); + } + + @Override + public Response> lpop(byte[] key, int count) { + return appendCommand(commandObjects.lpop(key, count)); + } + + @Override + public Response lpos(byte[] key, byte[] element) { + return appendCommand(commandObjects.lpos(key, element)); + } + + @Override + public Response lpos(byte[] key, byte[] element, LPosParams params) { + return appendCommand(commandObjects.lpos(key, element, params)); + } + + @Override + public Response> lpos(byte[] key, byte[] element, LPosParams params, long count) { + return appendCommand(commandObjects.lpos(key, element, params, count)); + } + + @Override + public Response rpop(byte[] key) { + return appendCommand(commandObjects.rpop(key)); + } + + @Override + public Response> rpop(byte[] key, int count) { + return appendCommand(commandObjects.rpop(key, count)); + } + + @Override + public Response linsert(byte[] key, ListPosition where, byte[] pivot, byte[] value) { + return appendCommand(commandObjects.linsert(key, where, pivot, value)); + } + + @Override + public Response lpushx(byte[] key, byte[]... args) { + return appendCommand(commandObjects.lpushx(key, args)); + } + + @Override + public Response rpushx(byte[] key, byte[]... args) { + return appendCommand(commandObjects.rpushx(key, args)); + } + + @Override + public Response> blpop(int timeout, byte[]... keys) { + return appendCommand(commandObjects.blpop(timeout, keys)); + } + + @Override + public Response> blpop(double timeout, byte[]... keys) { + return appendCommand(commandObjects.blpop(timeout, keys)); + } + + @Override + public Response> brpop(int timeout, byte[]... keys) { + return appendCommand(commandObjects.brpop(timeout, keys)); + } + + @Override + public Response> brpop(double timeout, byte[]... keys) { + return appendCommand(commandObjects.brpop(timeout, keys)); + } + + @Override + public Response rpoplpush(byte[] srckey, byte[] dstkey) { + return appendCommand(commandObjects.rpoplpush(srckey, dstkey)); + } + + @Override + public Response brpoplpush(byte[] source, byte[] destination, int timeout) { + return appendCommand(commandObjects.brpoplpush(source, destination, timeout)); + } + + @Override + public Response lmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to) { + return appendCommand(commandObjects.lmove(srcKey, dstKey, from, to)); + } + + @Override + public Response blmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to, double timeout) { + return appendCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); + } + + @Override + public Response>> lmpop(ListDirection direction, byte[]... keys) { + return appendCommand(commandObjects.lmpop(direction, keys)); + } + + @Override + public Response>> lmpop(ListDirection direction, int count, byte[]... keys) { + return appendCommand(commandObjects.lmpop(direction, count, keys)); + } + + @Override + public Response>> blmpop(double timeout, ListDirection direction, byte[]... keys) { + return appendCommand(commandObjects.blmpop(timeout, direction, keys)); + } + + @Override + public Response>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { + return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); + } + + @Override + public Response waitReplicas(byte[] sampleKey, int replicas, long timeout) { + return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); + } + + @Override + public Response> waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) { + return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); + } + + @Override + public Response eval(byte[] script, byte[] sampleKey) { + return appendCommand(commandObjects.eval(script, sampleKey)); + } + + @Override + public Response evalsha(byte[] sha1, byte[] sampleKey) { + return appendCommand(commandObjects.evalsha(sha1, sampleKey)); + } + + @Override + public Response> scriptExists(byte[] sampleKey, byte[]... sha1s) { + return appendCommand(commandObjects.scriptExists(sampleKey, sha1s)); + } + + @Override + public Response scriptLoad(byte[] script, byte[] sampleKey) { + return appendCommand(commandObjects.scriptLoad(script, sampleKey)); + } + + @Override + public Response scriptFlush(byte[] sampleKey) { + return appendCommand(commandObjects.scriptFlush(sampleKey)); + } + + @Override + public Response scriptFlush(byte[] sampleKey, FlushMode flushMode) { + return appendCommand(commandObjects.scriptFlush(sampleKey, flushMode)); + } + + @Override + public Response scriptKill(byte[] sampleKey) { + return appendCommand(commandObjects.scriptKill(sampleKey)); + } + + @Override + public Response eval(byte[] script) { + return appendCommand(commandObjects.eval(script)); + } + + @Override + public Response eval(byte[] script, int keyCount, byte[]... params) { + return appendCommand(commandObjects.eval(script, keyCount, params)); + } + + @Override + public Response eval(byte[] script, List keys, List args) { + return appendCommand(commandObjects.eval(script, keys, args)); + } + + @Override + public Response evalReadonly(byte[] script, List keys, List args) { + return appendCommand(commandObjects.evalReadonly(script, keys, args)); + } + + @Override + public Response evalsha(byte[] sha1) { + return appendCommand(commandObjects.evalsha(sha1)); + } + + @Override + public Response evalsha(byte[] sha1, int keyCount, byte[]... params) { + return appendCommand(commandObjects.evalsha(sha1, keyCount, params)); + } + + @Override + public Response evalsha(byte[] sha1, List keys, List args) { + return appendCommand(commandObjects.evalsha(sha1, keys, args)); + } + + @Override + public Response evalshaReadonly(byte[] sha1, List keys, List args) { + return appendCommand(commandObjects.evalshaReadonly(sha1, keys, args)); + } + + @Override + public Response sadd(byte[] key, byte[]... members) { + return appendCommand(commandObjects.sadd(key, members)); + } + + @Override + public Response> smembers(byte[] key) { + return appendCommand(commandObjects.smembers(key)); + } + + @Override + public Response srem(byte[] key, byte[]... members) { + return appendCommand(commandObjects.srem(key, members)); + } + + @Override + public Response spop(byte[] key) { + return appendCommand(commandObjects.spop(key)); + } + + @Override + public Response> spop(byte[] key, long count) { + return appendCommand(commandObjects.spop(key, count)); + } + + @Override + public Response scard(byte[] key) { + return appendCommand(commandObjects.scard(key)); + } + + @Override + public Response sismember(byte[] key, byte[] member) { + return appendCommand(commandObjects.sismember(key, member)); + } + + @Override + public Response> smismember(byte[] key, byte[]... members) { + return appendCommand(commandObjects.smismember(key, members)); + } + + @Override + public Response srandmember(byte[] key) { + return appendCommand(commandObjects.srandmember(key)); + } + + @Override + public Response> srandmember(byte[] key, int count) { + return appendCommand(commandObjects.srandmember(key, count)); + } + + @Override + public Response> sscan(byte[] key, byte[] cursor, ScanParams params) { + return appendCommand(commandObjects.sscan(key, cursor, params)); + } + + @Override + public Response> sdiff(byte[]... keys) { + return appendCommand(commandObjects.sdiff(keys)); + } + + @Override + public Response sdiffstore(byte[] dstkey, byte[]... keys) { + return appendCommand(commandObjects.sdiffstore(dstkey, keys)); + } + + @Override + public Response> sinter(byte[]... keys) { + return appendCommand(commandObjects.sinter(keys)); + } + + @Override + public Response sinterstore(byte[] dstkey, byte[]... keys) { + return appendCommand(commandObjects.sinterstore(dstkey, keys)); + } + + @Override + public Response sintercard(byte[]... keys) { + return appendCommand(commandObjects.sintercard(keys)); + } + + @Override + public Response sintercard(int limit, byte[]... keys) { + return appendCommand(commandObjects.sintercard(limit, keys)); + } + + @Override + public Response> sunion(byte[]... keys) { + return appendCommand(commandObjects.sunion(keys)); + } + + @Override + public Response sunionstore(byte[] dstkey, byte[]... keys) { + return appendCommand(commandObjects.sunionstore(dstkey, keys)); + } + + @Override + public Response smove(byte[] srckey, byte[] dstkey, byte[] member) { + return appendCommand(commandObjects.smove(srckey, dstkey, member)); + } + + @Override + public Response zadd(byte[] key, double score, byte[] member) { + return appendCommand(commandObjects.zadd(key, score, member)); + } + + @Override + public Response zadd(byte[] key, double score, byte[] member, ZAddParams params) { + return appendCommand(commandObjects.zadd(key, score, member, params)); + } + + @Override + public Response zadd(byte[] key, Map scoreMembers) { + return appendCommand(commandObjects.zadd(key, scoreMembers)); + } + + @Override + public Response zadd(byte[] key, Map scoreMembers, ZAddParams params) { + return appendCommand(commandObjects.zadd(key, scoreMembers, params)); + } + + @Override + public Response zaddIncr(byte[] key, double score, byte[] member, ZAddParams params) { + return appendCommand(commandObjects.zaddIncr(key, score, member, params)); + } + + @Override + public Response zrem(byte[] key, byte[]... members) { + return appendCommand(commandObjects.zrem(key, members)); + } + + @Override + public Response zincrby(byte[] key, double increment, byte[] member) { + return appendCommand(commandObjects.zincrby(key, increment, member)); + } + + @Override + public Response zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params) { + return appendCommand(commandObjects.zincrby(key, increment, member, params)); + } + + @Override + public Response zrank(byte[] key, byte[] member) { + return appendCommand(commandObjects.zrank(key, member)); + } + + @Override + public Response zrevrank(byte[] key, byte[] member) { + return appendCommand(commandObjects.zrevrank(key, member)); + } + + @Override + public Response> zrankWithScore(byte[] key, byte[] member) { + return appendCommand(commandObjects.zrankWithScore(key, member)); + } + + @Override + public Response> zrevrankWithScore(byte[] key, byte[] member) { + return appendCommand(commandObjects.zrevrankWithScore(key, member)); + } + + @Override + public Response> zrange(byte[] key, long start, long stop) { + return appendCommand(commandObjects.zrange(key, start, stop)); + } + + @Override + public Response> zrevrange(byte[] key, long start, long stop) { + return appendCommand(commandObjects.zrevrange(key, start, stop)); + } + + @Override + public Response> zrangeWithScores(byte[] key, long start, long stop) { + return appendCommand(commandObjects.zrangeWithScores(key, start, stop)); + } + + @Override + public Response> zrevrangeWithScores(byte[] key, long start, long stop) { + return appendCommand(commandObjects.zrevrangeWithScores(key, start, stop)); + } + + @Override + public Response zrandmember(byte[] key) { + return appendCommand(commandObjects.zrandmember(key)); + } + + @Override + public Response> zrandmember(byte[] key, long count) { + return appendCommand(commandObjects.zrandmember(key, count)); + } + + @Override + public Response> zrandmemberWithScores(byte[] key, long count) { + return appendCommand(commandObjects.zrandmemberWithScores(key, count)); + } + + @Override + public Response zcard(byte[] key) { + return appendCommand(commandObjects.zcard(key)); + } + + @Override + public Response zscore(byte[] key, byte[] member) { + return appendCommand(commandObjects.zscore(key, member)); + } + + @Override + public Response> zmscore(byte[] key, byte[]... members) { + return appendCommand(commandObjects.zmscore(key, members)); + } + + @Override + public Response zpopmax(byte[] key) { + return appendCommand(commandObjects.zpopmax(key)); + } + + @Override + public Response> zpopmax(byte[] key, int count) { + return appendCommand(commandObjects.zpopmax(key, count)); + } + + @Override + public Response zpopmin(byte[] key) { + return appendCommand(commandObjects.zpopmin(key)); + } + + @Override + public Response> zpopmin(byte[] key, int count) { + return appendCommand(commandObjects.zpopmin(key, count)); + } + + @Override + public Response zcount(byte[] key, double min, double max) { + return appendCommand(commandObjects.zcount(key, min, max)); + } + + @Override + public Response zcount(byte[] key, byte[] min, byte[] max) { + return appendCommand(commandObjects.zcount(key, min, max)); + } + + @Override + public Response> zrangeByScore(byte[] key, double min, double max) { + return appendCommand(commandObjects.zrangeByScore(key, min, max)); + } + + @Override + public Response> zrangeByScore(byte[] key, byte[] min, byte[] max) { + return appendCommand(commandObjects.zrangeByScore(key, min, max)); + } + + @Override + public Response> zrevrangeByScore(byte[] key, double max, double min) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); + } + + @Override + public Response> zrangeByScore(byte[] key, double min, double max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScore(byte[] key, byte[] max, byte[] min) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); + } + + @Override + public Response> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScore(byte[] key, double max, double min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); + } + + @Override + public Response> zrangeByScoreWithScores(byte[] key, double min, double max) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); + } + + @Override + public Response> zrevrangeByScoreWithScores(byte[] key, double max, double min) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); + } + + @Override + public Response> zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); + } + + @Override + public Response> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); + } + + @Override + public Response> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); + } + + @Override + public Response> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count) { + return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); + } + + @Override + public Response> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); + } + + @Override + public Response zremrangeByRank(byte[] key, long start, long stop) { + return appendCommand(commandObjects.zremrangeByRank(key, start, stop)); + } + + @Override + public Response zremrangeByScore(byte[] key, double min, double max) { + return appendCommand(commandObjects.zremrangeByScore(key, min, max)); + } + + @Override + public Response zremrangeByScore(byte[] key, byte[] min, byte[] max) { + return appendCommand(commandObjects.zremrangeByScore(key, min, max)); + } + + @Override + public Response zlexcount(byte[] key, byte[] min, byte[] max) { + return appendCommand(commandObjects.zlexcount(key, min, max)); + } + + @Override + public Response> zrangeByLex(byte[] key, byte[] min, byte[] max) { + return appendCommand(commandObjects.zrangeByLex(key, min, max)); + } + + @Override + public Response> zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count) { + return appendCommand(commandObjects.zrangeByLex(key, min, max, offset, count)); + } + + @Override + public Response> zrevrangeByLex(byte[] key, byte[] max, byte[] min) { + return appendCommand(commandObjects.zrevrangeByLex(key, max, min)); + } + + @Override + public Response> zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count) { + return appendCommand(commandObjects.zrevrangeByLex(key, max, min, offset, count)); + } + + @Override + public Response> zrange(byte[] key, ZRangeParams zRangeParams) { + return appendCommand(commandObjects.zrange(key, zRangeParams)); + } + + @Override + public Response> zrangeWithScores(byte[] key, ZRangeParams zRangeParams) { + return appendCommand(commandObjects.zrangeWithScores(key, zRangeParams)); + } + + @Override + public Response zrangestore(byte[] dest, byte[] src, ZRangeParams zRangeParams) { + return appendCommand(commandObjects.zrangestore(dest, src, zRangeParams)); + } + + @Override + public Response zremrangeByLex(byte[] key, byte[] min, byte[] max) { + return appendCommand(commandObjects.zremrangeByLex(key, min, max)); + } + + @Override + public Response> zscan(byte[] key, byte[] cursor, ScanParams params) { + return appendCommand(commandObjects.zscan(key, cursor, params)); + } + + @Override + public Response> bzpopmax(double timeout, byte[]... keys) { + return appendCommand(commandObjects.bzpopmax(timeout, keys)); + } + + @Override + public Response> bzpopmin(double timeout, byte[]... keys) { + return appendCommand(commandObjects.bzpopmin(timeout, keys)); + } + + @Override + public Response>> zmpop(SortedSetOption option, byte[]... keys) { + return appendCommand(commandObjects.zmpop(option, keys)); + } + + @Override + public Response>> zmpop(SortedSetOption option, int count, byte[]... keys) { + return appendCommand(commandObjects.zmpop(option, count, keys)); + } + + @Override + public Response>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { + return appendCommand(commandObjects.bzmpop(timeout, option, keys)); + } + + @Override + public Response>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { + return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); + } + + @Override + public Response> zdiff(byte[]... keys) { + return appendCommand(commandObjects.zdiff(keys)); + } + + @Override + public Response> zdiffWithScores(byte[]... keys) { + return appendCommand(commandObjects.zdiffWithScores(keys)); + } + + @Override + @Deprecated + public Response zdiffStore(byte[] dstkey, byte[]... keys) { + return appendCommand(commandObjects.zdiffStore(dstkey, keys)); + } + + @Override + public Response zdiffstore(byte[] dstkey, byte[]... keys) { + return appendCommand(commandObjects.zdiffstore(dstkey, keys)); + } + + @Override + public Response> zinter(ZParams params, byte[]... keys) { + return appendCommand(commandObjects.zinter(params, keys)); + } + + @Override + public Response> zinterWithScores(ZParams params, byte[]... keys) { + return appendCommand(commandObjects.zinterWithScores(params, keys)); + } + + @Override + public Response zinterstore(byte[] dstkey, byte[]... sets) { + return appendCommand(commandObjects.zinterstore(dstkey, sets)); + } + + @Override + public Response zinterstore(byte[] dstkey, ZParams params, byte[]... sets) { + return appendCommand(commandObjects.zinterstore(dstkey, params, sets)); + } + + @Override + public Response zintercard(byte[]... keys) { + return appendCommand(commandObjects.zintercard(keys)); + } + + @Override + public Response zintercard(long limit, byte[]... keys) { + return appendCommand(commandObjects.zintercard(limit, keys)); + } + + @Override + public Response> zunion(ZParams params, byte[]... keys) { + return appendCommand(commandObjects.zunion(params, keys)); + } + + @Override + public Response> zunionWithScores(ZParams params, byte[]... keys) { + return appendCommand(commandObjects.zunionWithScores(params, keys)); + } + + @Override + public Response zunionstore(byte[] dstkey, byte[]... sets) { + return appendCommand(commandObjects.zunionstore(dstkey, sets)); + } + + @Override + public Response zunionstore(byte[] dstkey, ZParams params, byte[]... sets) { + return appendCommand(commandObjects.zunionstore(dstkey, params, sets)); + } + + @Override + public Response xadd(byte[] key, XAddParams params, Map hash) { + return appendCommand(commandObjects.xadd(key, params, hash)); + } + + @Override + public Response xlen(byte[] key) { + return appendCommand(commandObjects.xlen(key)); + } + + @Override + public Response> xrange(byte[] key, byte[] start, byte[] end) { + return appendCommand(commandObjects.xrange(key, start, end)); + } + + @Override + public Response> xrange(byte[] key, byte[] start, byte[] end, int count) { + return appendCommand(commandObjects.xrange(key, start, end, count)); + } + + @Override + public Response> xrevrange(byte[] key, byte[] end, byte[] start) { + return appendCommand(commandObjects.xrevrange(key, end, start)); + } + + @Override + public Response> xrevrange(byte[] key, byte[] end, byte[] start, int count) { + return appendCommand(commandObjects.xrevrange(key, end, start, count)); + } + + @Override + public Response xack(byte[] key, byte[] group, byte[]... ids) { + return appendCommand(commandObjects.xack(key, group, ids)); + } + + @Override + public Response xgroupCreate(byte[] key, byte[] groupName, byte[] id, boolean makeStream) { + return appendCommand(commandObjects.xgroupCreate(key, groupName, id, makeStream)); + } + + @Override + public Response xgroupSetID(byte[] key, byte[] groupName, byte[] id) { + return appendCommand(commandObjects.xgroupSetID(key, groupName, id)); + } + + @Override + public Response xgroupDestroy(byte[] key, byte[] groupName) { + return appendCommand(commandObjects.xgroupDestroy(key, groupName)); + } + + @Override + public Response xgroupCreateConsumer(byte[] key, byte[] groupName, byte[] consumerName) { + return appendCommand(commandObjects.xgroupCreateConsumer(key, groupName, consumerName)); + } + + @Override + public Response xgroupDelConsumer(byte[] key, byte[] groupName, byte[] consumerName) { + return appendCommand(commandObjects.xgroupDelConsumer(key, groupName, consumerName)); + } + + @Override + public Response xdel(byte[] key, byte[]... ids) { + return appendCommand(commandObjects.xdel(key, ids)); + } + + @Override + public Response xtrim(byte[] key, long maxLen, boolean approximateLength) { + return appendCommand(commandObjects.xtrim(key, maxLen, approximateLength)); + } + + @Override + public Response xtrim(byte[] key, XTrimParams params) { + return appendCommand(commandObjects.xtrim(key, params)); + } + + @Override + public Response xpending(byte[] key, byte[] groupName) { + return appendCommand(commandObjects.xpending(key, groupName)); + } + + @Override + public Response> xpending(byte[] key, byte[] groupName, XPendingParams params) { + return appendCommand(commandObjects.xpending(key, groupName, params)); + } + + @Override + public Response> xclaim(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { + return appendCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); + } + + @Override + public Response> xclaimJustId(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { + return appendCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); + } + + @Override + public Response> xautoclaim(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { + return appendCommand(commandObjects.xautoclaim(key, groupName, consumerName, minIdleTime, start, params)); + } + + @Override + public Response> xautoclaimJustId(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { + return appendCommand(commandObjects.xautoclaimJustId(key, groupName, consumerName, minIdleTime, start, params)); + } + + @Override + public Response xinfoStream(byte[] key) { + return appendCommand(commandObjects.xinfoStream(key)); + } + + @Override + public Response xinfoStreamFull(byte[] key) { + return appendCommand(commandObjects.xinfoStreamFull(key)); + } + + @Override + public Response xinfoStreamFull(byte[] key, int count) { + return appendCommand(commandObjects.xinfoStreamFull(key, count)); + } + + @Override + public Response> xinfoGroups(byte[] key) { + return appendCommand(commandObjects.xinfoGroups(key)); + } + + @Override + public Response> xinfoConsumers(byte[] key, byte[] group) { + return appendCommand(commandObjects.xinfoConsumers(key, group)); + } + + @Override + public Response> xread(XReadParams xReadParams, Map.Entry... streams) { + return appendCommand(commandObjects.xread(xReadParams, streams)); + } + + @Override + public Response> xreadGroup(byte[] groupName, byte[] consumer, + XReadGroupParams xReadGroupParams, Map.Entry... streams) { + return appendCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); + } + + @Override + public Response set(byte[] key, byte[] value) { + return appendCommand(commandObjects.set(key, value)); + } + + @Override + public Response set(byte[] key, byte[] value, SetParams params) { + return appendCommand(commandObjects.set(key, value, params)); + } + + @Override + public Response get(byte[] key) { + return appendCommand(commandObjects.get(key)); + } + + @Override + public Response setGet(byte[] key, byte[] value, SetParams params) { + return appendCommand(commandObjects.setGet(key, value, params)); + } + + @Override + public Response getDel(byte[] key) { + return appendCommand(commandObjects.getDel(key)); + } + + @Override + public Response getEx(byte[] key, GetExParams params) { + return appendCommand(commandObjects.getEx(key, params)); + } + + @Override + public Response setbit(byte[] key, long offset, boolean value) { + return appendCommand(commandObjects.setbit(key, offset, value)); + } + + @Override + public Response getbit(byte[] key, long offset) { + return appendCommand(commandObjects.getbit(key, offset)); + } + + @Override + public Response setrange(byte[] key, long offset, byte[] value) { + return appendCommand(commandObjects.setrange(key, offset, value)); + } + + @Override + public Response getrange(byte[] key, long startOffset, long endOffset) { + return appendCommand(commandObjects.getrange(key, startOffset, endOffset)); + } + + @Override + public Response getSet(byte[] key, byte[] value) { + return appendCommand(commandObjects.getSet(key, value)); + } + + @Override + public Response setnx(byte[] key, byte[] value) { + return appendCommand(commandObjects.setnx(key, value)); + } + + @Override + public Response setex(byte[] key, long seconds, byte[] value) { + return appendCommand(commandObjects.setex(key, seconds, value)); + } + + @Override + public Response psetex(byte[] key, long milliseconds, byte[] value) { + return appendCommand(commandObjects.psetex(key, milliseconds, value)); + } + + @Override + public Response> mget(byte[]... keys) { + return appendCommand(commandObjects.mget(keys)); + } + + @Override + public Response mset(byte[]... keysvalues) { + return appendCommand(commandObjects.mset(keysvalues)); + } + + @Override + public Response msetnx(byte[]... keysvalues) { + return appendCommand(commandObjects.msetnx(keysvalues)); + } + + @Override + public Response incr(byte[] key) { + return appendCommand(commandObjects.incr(key)); + } + + @Override + public Response incrBy(byte[] key, long increment) { + return appendCommand(commandObjects.incrBy(key, increment)); + } + + @Override + public Response incrByFloat(byte[] key, double increment) { + return appendCommand(commandObjects.incrByFloat(key, increment)); + } + + @Override + public Response decr(byte[] key) { + return appendCommand(commandObjects.decr(key)); + } + + @Override + public Response decrBy(byte[] key, long decrement) { + return appendCommand(commandObjects.decrBy(key, decrement)); + } + + @Override + public Response append(byte[] key, byte[] value) { + return appendCommand(commandObjects.append(key, value)); + } + + @Override + public Response substr(byte[] key, int start, int end) { + return appendCommand(commandObjects.substr(key, start, end)); + } + + @Override + public Response strlen(byte[] key) { + return appendCommand(commandObjects.strlen(key)); + } + + @Override + public Response bitcount(byte[] key) { + return appendCommand(commandObjects.bitcount(key)); + } + + @Override + public Response bitcount(byte[] key, long start, long end) { + return appendCommand(commandObjects.bitcount(key, start, end)); + } + + @Override + public Response bitcount(byte[] key, long start, long end, BitCountOption option) { + return appendCommand(commandObjects.bitcount(key, start, end, option)); + } + + @Override + public Response bitpos(byte[] key, boolean value) { + return appendCommand(commandObjects.bitpos(key, value)); + } + + @Override + public Response bitpos(byte[] key, boolean value, BitPosParams params) { + return appendCommand(commandObjects.bitpos(key, value, params)); + } + + @Override + public Response> bitfield(byte[] key, byte[]... arguments) { + return appendCommand(commandObjects.bitfield(key, arguments)); + } + + @Override + public Response> bitfieldReadonly(byte[] key, byte[]... arguments) { + return appendCommand(commandObjects.bitfieldReadonly(key, arguments)); + } + + @Override + public Response bitop(BitOP op, byte[] destKey, byte[]... srcKeys) { + return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); + } + + // RediSearch commands + @Override + public Response ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { + return appendCommand(commandObjects.ftCreate(indexName, indexOptions, schema)); + } + + @Override + public Response ftCreate(String indexName, FTCreateParams createParams, Iterable schemaFields) { + return appendCommand(commandObjects.ftCreate(indexName, createParams, schemaFields)); + } + + @Override + public Response ftAlter(String indexName, Schema schema) { + return appendCommand(commandObjects.ftAlter(indexName, schema)); + } + + @Override + public Response ftAlter(String indexName, Iterable schemaFields) { + return appendCommand(commandObjects.ftAlter(indexName, schemaFields)); + } + + @Override + public Response ftAliasAdd(String aliasName, String indexName) { + return appendCommand(commandObjects.ftAliasAdd(aliasName, indexName)); + } + + @Override + public Response ftAliasUpdate(String aliasName, String indexName) { + return appendCommand(commandObjects.ftAliasUpdate(aliasName, indexName)); + } + + @Override + public Response ftAliasDel(String aliasName) { + return appendCommand(commandObjects.ftAliasDel(aliasName)); + } + + @Override + public Response ftDropIndex(String indexName) { + return appendCommand(commandObjects.ftDropIndex(indexName)); + } + + @Override + public Response ftDropIndexDD(String indexName) { + return appendCommand(commandObjects.ftDropIndexDD(indexName)); + } + + @Override + public Response ftSearch(String indexName, String query) { + return appendCommand(commandObjects.ftSearch(indexName, query)); + } + + @Override + public Response ftSearch(String indexName, String query, FTSearchParams searchParams) { + return appendCommand(commandObjects.ftSearch(indexName, query, searchParams)); + } + + @Override + public Response ftSearch(String indexName, Query query) { + return appendCommand(commandObjects.ftSearch(indexName, query)); + } + + @Override + @Deprecated + public Response ftSearch(byte[] indexName, Query query) { + return appendCommand(commandObjects.ftSearch(indexName, query)); + } + + @Override + public Response ftExplain(String indexName, Query query) { + return appendCommand(commandObjects.ftExplain(indexName, query)); + } + + @Override + public Response> ftExplainCLI(String indexName, Query query) { + return appendCommand(commandObjects.ftExplainCLI(indexName, query)); + } + + @Override + public Response ftAggregate(String indexName, AggregationBuilder aggr) { + return appendCommand(commandObjects.ftAggregate(indexName, aggr)); + } + + @Override + public Response ftSynUpdate(String indexName, String synonymGroupId, String... terms) { + return appendCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms)); + } + + @Override + public Response>> ftSynDump(String indexName) { + return appendCommand(commandObjects.ftSynDump(indexName)); + } + + @Override + public Response ftDictAdd(String dictionary, String... terms) { + return appendCommand(commandObjects.ftDictAdd(dictionary, terms)); + } + + @Override + public Response ftDictDel(String dictionary, String... terms) { + return appendCommand(commandObjects.ftDictDel(dictionary, terms)); + } + + @Override + public Response> ftDictDump(String dictionary) { + return appendCommand(commandObjects.ftDictDump(dictionary)); + } + + @Override + public Response ftDictAddBySampleKey(String indexName, String dictionary, String... terms) { + return appendCommand(commandObjects.ftDictAddBySampleKey(indexName, dictionary, terms)); + } + + @Override + public Response ftDictDelBySampleKey(String indexName, String dictionary, String... terms) { + return appendCommand(commandObjects.ftDictDelBySampleKey(indexName, dictionary, terms)); + } + + @Override + public Response> ftDictDumpBySampleKey(String indexName, String dictionary) { + return appendCommand(commandObjects.ftDictDumpBySampleKey(indexName, dictionary)); + } + + @Override + public Response>> ftSpellCheck(String index, String query) { + return appendCommand(commandObjects.ftSpellCheck(index, query)); + } + + @Override + public Response>> ftSpellCheck(String index, String query, FTSpellCheckParams spellCheckParams) { + return appendCommand(commandObjects.ftSpellCheck(index, query, spellCheckParams)); + } + + @Override + public Response> ftInfo(String indexName) { + return appendCommand(commandObjects.ftInfo(indexName)); + } + + @Override + public Response> ftTagVals(String indexName, String fieldName) { + return appendCommand(commandObjects.ftTagVals(indexName, fieldName)); + } + + @Override + public Response> ftConfigGet(String option) { + return appendCommand(commandObjects.ftConfigGet(option)); + } + + @Override + public Response> ftConfigGet(String indexName, String option) { + return appendCommand(commandObjects.ftConfigGet(indexName, option)); + } + + @Override + public Response ftConfigSet(String option, String value) { + return appendCommand(commandObjects.ftConfigSet(option, value)); + } + + @Override + public Response ftConfigSet(String indexName, String option, String value) { + return appendCommand(commandObjects.ftConfigSet(indexName, option, value)); + } + + @Override + public Response ftSugAdd(String key, String string, double score) { + return appendCommand(commandObjects.ftSugAdd(key, string, score)); + } + + @Override + public Response ftSugAddIncr(String key, String string, double score) { + return appendCommand(commandObjects.ftSugAddIncr(key, string, score)); + } + + @Override + public Response> ftSugGet(String key, String prefix) { + return appendCommand(commandObjects.ftSugGet(key, prefix)); + } + + @Override + public Response> ftSugGet(String key, String prefix, boolean fuzzy, int max) { + return appendCommand(commandObjects.ftSugGet(key, prefix, fuzzy, max)); + } + + @Override + public Response> ftSugGetWithScores(String key, String prefix) { + return appendCommand(commandObjects.ftSugGetWithScores(key, prefix)); + } + + @Override + public Response> ftSugGetWithScores(String key, String prefix, boolean fuzzy, int max) { + return appendCommand(commandObjects.ftSugGetWithScores(key, prefix, fuzzy, max)); + } + + @Override + public Response ftSugDel(String key, String string) { + return appendCommand(commandObjects.ftSugDel(key, string)); + } + + @Override + public Response ftSugLen(String key) { + return appendCommand(commandObjects.ftSugLen(key)); + } + // RediSearch commands + + // RedisJSON commands + @Override + public Response lcs(byte[] keyA, byte[] keyB, LCSParams params) { + return appendCommand(commandObjects.lcs(keyA, keyB, params)); + } + + @Override + public Response jsonSet(String key, Path2 path, Object object) { + return appendCommand(commandObjects.jsonSet(key, path, object)); + } + + @Override + public Response jsonSetWithEscape(String key, Path2 path, Object object) { + return appendCommand(commandObjects.jsonSetWithEscape(key, path, object)); + } + + @Override + public Response jsonSet(String key, Path path, Object object) { + return appendCommand(commandObjects.jsonSet(key, path, object)); + } + + @Override + public Response jsonSet(String key, Path2 path, Object object, JsonSetParams params) { + return appendCommand(commandObjects.jsonSet(key, path, object, params)); + } + + @Override + public Response jsonSetWithEscape(String key, Path2 path, Object object, JsonSetParams params) { + return appendCommand(commandObjects.jsonSetWithEscape(key, path, object, params)); + } + + @Override + public Response jsonSet(String key, Path path, Object object, JsonSetParams params) { + return appendCommand(commandObjects.jsonSet(key, path, object, params)); + } + + @Override + public Response jsonMerge(String key, Path2 path, Object object) { + return appendCommand(commandObjects.jsonMerge(key, path, object)); + } + + @Override + public Response jsonMerge(String key, Path path, Object object) { + return appendCommand(commandObjects.jsonMerge(key, path, object)); + } + + @Override + public Response jsonGet(String key) { + return appendCommand(commandObjects.jsonGet(key)); + } + + @Override + public Response jsonGet(String key, Class clazz) { + return appendCommand(commandObjects.jsonGet(key, clazz)); + } + + @Override + public Response jsonGet(String key, Path2... paths) { + return appendCommand(commandObjects.jsonGet(key, paths)); + } + + @Override + public Response jsonGet(String key, Path... paths) { + return appendCommand(commandObjects.jsonGet(key, paths)); + } + + @Override + public Response jsonGet(String key, Class clazz, Path... paths) { + return appendCommand(commandObjects.jsonGet(key, clazz, paths)); + } + + @Override + public Response> jsonMGet(Path2 path, String... keys) { + return appendCommand(commandObjects.jsonMGet(path, keys)); + } + + @Override + public Response> jsonMGet(Path path, Class clazz, String... keys) { + return appendCommand(commandObjects.jsonMGet(path, clazz, keys)); + } + + @Override + public Response jsonDel(String key) { + return appendCommand(commandObjects.jsonDel(key)); + } + + @Override + public Response jsonDel(String key, Path2 path) { + return appendCommand(commandObjects.jsonDel(key, path)); + } + + @Override + public Response jsonDel(String key, Path path) { + return appendCommand(commandObjects.jsonDel(key, path)); + } + + @Override + public Response jsonClear(String key) { + return appendCommand(commandObjects.jsonClear(key)); + } + + @Override + public Response jsonClear(String key, Path2 path) { + return appendCommand(commandObjects.jsonClear(key, path)); + } + + @Override + public Response jsonClear(String key, Path path) { + return appendCommand(commandObjects.jsonClear(key, path)); + } + + @Override + public Response> jsonToggle(String key, Path2 path) { + return appendCommand(commandObjects.jsonToggle(key, path)); + } + + @Override + public Response jsonToggle(String key, Path path) { + return appendCommand(commandObjects.jsonToggle(key, path)); + } + + @Override + public Response> jsonType(String key) { + return appendCommand(commandObjects.jsonType(key)); + } + + @Override + public Response>> jsonType(String key, Path2 path) { + return appendCommand(commandObjects.jsonType(key, path)); + } + + @Override + public Response> jsonType(String key, Path path) { + return appendCommand(commandObjects.jsonType(key, path)); + } + + @Override + public Response jsonStrAppend(String key, Object string) { + return appendCommand(commandObjects.jsonStrAppend(key, string)); + } + + @Override + public Response> jsonStrAppend(String key, Path2 path, Object string) { + return appendCommand(commandObjects.jsonStrAppend(key, path, string)); + } + + @Override + public Response jsonStrAppend(String key, Path path, Object string) { + return appendCommand(commandObjects.jsonStrAppend(key, path, string)); + } + + @Override + public Response jsonStrLen(String key) { + return appendCommand(commandObjects.jsonStrLen(key)); + } + + @Override + public Response> jsonStrLen(String key, Path2 path) { + return appendCommand(commandObjects.jsonStrLen(key, path)); + } + + @Override + public Response jsonStrLen(String key, Path path) { + return appendCommand(commandObjects.jsonStrLen(key, path)); + } + + @Override + public Response jsonNumIncrBy(String key, Path2 path, double value) { + return appendCommand(commandObjects.jsonNumIncrBy(key, path, value)); + } + + @Override + public Response jsonNumIncrBy(String key, Path path, double value) { + return appendCommand(commandObjects.jsonNumIncrBy(key, path, value)); + } + + @Override + public Response> jsonArrAppend(String key, Path2 path, Object... objects) { + return appendCommand(commandObjects.jsonArrAppend(key, path, objects)); + } + + @Override + public Response> jsonArrAppendWithEscape(String key, Path2 path, Object... objects) { + return appendCommand(commandObjects.jsonArrAppendWithEscape(key, path, objects)); + } + + @Override + public Response jsonArrAppend(String key, Path path, Object... objects) { + return appendCommand(commandObjects.jsonArrAppend(key, path, objects)); + } + + @Override + public Response> jsonArrIndex(String key, Path2 path, Object scalar) { + return appendCommand(commandObjects.jsonArrIndex(key, path, scalar)); + } + + @Override + public Response> jsonArrIndexWithEscape(String key, Path2 path, Object scalar) { + return appendCommand(commandObjects.jsonArrIndexWithEscape(key, path, scalar)); + } + + @Override + public Response jsonArrIndex(String key, Path path, Object scalar) { + return appendCommand(commandObjects.jsonArrIndex(key, path, scalar)); + } + + @Override + public Response> jsonArrInsert(String key, Path2 path, int index, Object... objects) { + return appendCommand(commandObjects.jsonArrInsert(key, path, index, objects)); + } + + @Override + public Response> jsonArrInsertWithEscape(String key, Path2 path, int index, Object... objects) { + return appendCommand(commandObjects.jsonArrInsertWithEscape(key, path, index, objects)); + } + + @Override + public Response jsonArrInsert(String key, Path path, int index, Object... pojos) { + return appendCommand(commandObjects.jsonArrInsert(key, path, index, pojos)); + } + + @Override + public Response jsonArrPop(String key) { + return appendCommand(commandObjects.jsonArrPop(key)); + } + + @Override + public Response jsonArrLen(String key, Path path) { + return appendCommand(commandObjects.jsonArrLen(key, path)); + } + + @Override + public Response> jsonArrTrim(String key, Path2 path, int start, int stop) { + return appendCommand(commandObjects.jsonArrTrim(key, path, start, stop)); + } + + @Override + public Response jsonArrTrim(String key, Path path, int start, int stop) { + return appendCommand(commandObjects.jsonArrTrim(key, path, start, stop)); + } + + @Override + public Response jsonArrPop(String key, Class clazz, Path path) { + return appendCommand(commandObjects.jsonArrPop(key, clazz, path)); + } + + @Override + public Response> jsonArrPop(String key, Path2 path, int index) { + return appendCommand(commandObjects.jsonArrPop(key, path, index)); + } + + @Override + public Response jsonArrPop(String key, Path path, int index) { + return appendCommand(commandObjects.jsonArrPop(key, path, index)); + } + + @Override + public Response jsonArrPop(String key, Class clazz, Path path, int index) { + return appendCommand(commandObjects.jsonArrPop(key, clazz, path, index)); + } + + @Override + public Response jsonArrLen(String key) { + return appendCommand(commandObjects.jsonArrLen(key)); + } + + @Override + public Response> jsonArrLen(String key, Path2 path) { + return appendCommand(commandObjects.jsonArrLen(key, path)); + } + + @Override + public Response jsonArrPop(String key, Class clazz) { + return appendCommand(commandObjects.jsonArrPop(key, clazz)); + } + + @Override + public Response> jsonArrPop(String key, Path2 path) { + return appendCommand(commandObjects.jsonArrPop(key, path)); + } + + @Override + public Response jsonArrPop(String key, Path path) { + return appendCommand(commandObjects.jsonArrPop(key, path)); + } + // RedisJSON commands + + // RedisTimeSeries commands + @Override + public Response tsCreate(String key) { + return appendCommand(commandObjects.tsCreate(key)); + } + + @Override + public Response tsCreate(String key, TSCreateParams createParams) { + return appendCommand(commandObjects.tsCreate(key, createParams)); + } + + @Override + public Response tsDel(String key, long fromTimestamp, long toTimestamp) { + return appendCommand(commandObjects.tsDel(key, fromTimestamp, toTimestamp)); + } + + @Override + public Response tsAlter(String key, TSAlterParams alterParams) { + return appendCommand(commandObjects.tsAlter(key, alterParams)); + } + + @Override + public Response tsAdd(String key, double value) { + return appendCommand(commandObjects.tsAdd(key, value)); + } + + @Override + public Response tsAdd(String key, long timestamp, double value) { + return appendCommand(commandObjects.tsAdd(key, timestamp, value)); + } + + @Override + public Response tsAdd(String key, long timestamp, double value, TSCreateParams createParams) { + return appendCommand(commandObjects.tsAdd(key, timestamp, value, createParams)); + } + + @Override + public Response> tsMAdd(Map.Entry... entries) { + return appendCommand(commandObjects.tsMAdd(entries)); + } + + @Override + public Response tsIncrBy(String key, double value) { + return appendCommand(commandObjects.tsIncrBy(key, value)); + } + + @Override + public Response tsIncrBy(String key, double value, long timestamp) { + return appendCommand(commandObjects.tsIncrBy(key, value, timestamp)); + } + + @Override + public Response tsDecrBy(String key, double value) { + return appendCommand(commandObjects.tsDecrBy(key, value)); + } + + @Override + public Response tsDecrBy(String key, double value, long timestamp) { + return appendCommand(commandObjects.tsDecrBy(key, value, timestamp)); + } + + @Override + public Response> tsRange(String key, long fromTimestamp, long toTimestamp) { + return appendCommand(commandObjects.tsRange(key, fromTimestamp, toTimestamp)); + } + + @Override + public Response> tsRange(String key, TSRangeParams rangeParams) { + return appendCommand(commandObjects.tsRange(key, rangeParams)); + } + + @Override + public Response> tsRevRange(String key, long fromTimestamp, long toTimestamp) { + return appendCommand(commandObjects.tsRevRange(key, fromTimestamp, toTimestamp)); + } + + @Override + public Response> tsRevRange(String key, TSRangeParams rangeParams) { + return appendCommand(commandObjects.tsRevRange(key, rangeParams)); + } + + @Override + public Response> tsMRange(long fromTimestamp, long toTimestamp, String... filters) { + return appendCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); + } + + @Override + public Response> tsMRange(TSMRangeParams multiRangeParams) { + return appendCommand(commandObjects.tsMRange(multiRangeParams)); + } + + @Override + public Response> tsMRevRange(long fromTimestamp, long toTimestamp, String... filters) { + return appendCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); + } + + @Override + public Response> tsMRevRange(TSMRangeParams multiRangeParams) { + return appendCommand(commandObjects.tsMRevRange(multiRangeParams)); + } + + @Override + public Response tsGet(String key) { + return appendCommand(commandObjects.tsGet(key)); + } + + @Override + public Response tsGet(String key, TSGetParams getParams) { + return appendCommand(commandObjects.tsGet(key, getParams)); + } + + @Override + public Response> tsMGet(TSMGetParams multiGetParams, String... filters) { + return appendCommand(commandObjects.tsMGet(multiGetParams, filters)); + } + + @Override + public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long timeBucket) { + return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); + } + + @Override + public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long bucketDuration, long alignTimestamp) { + return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, bucketDuration, alignTimestamp)); + } + + @Override + public Response tsDeleteRule(String sourceKey, String destKey) { + return appendCommand(commandObjects.tsDeleteRule(sourceKey, destKey)); + } + + @Override + public Response> tsQueryIndex(String... filters) { + return appendCommand(commandObjects.tsQueryIndex(filters)); + } + // RedisTimeSeries commands + + // RedisBloom commands + @Override + public Response bfReserve(String key, double errorRate, long capacity) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity)); + } + + @Override + public Response bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity, reserveParams)); + } + + @Override + public Response bfAdd(String key, String item) { + return appendCommand(commandObjects.bfAdd(key, item)); + } + + @Override + public Response> bfMAdd(String key, String... items) { + return appendCommand(commandObjects.bfMAdd(key, items)); + } + + @Override + public Response> bfInsert(String key, String... items) { + return appendCommand(commandObjects.bfInsert(key, items)); + } + + @Override + public Response> bfInsert(String key, BFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.bfInsert(key, insertParams, items)); + } + + @Override + public Response bfExists(String key, String item) { + return appendCommand(commandObjects.bfExists(key, item)); + } + + @Override + public Response> bfMExists(String key, String... items) { + return appendCommand(commandObjects.bfMExists(key, items)); + } + + @Override + public Response> bfScanDump(String key, long iterator) { + return appendCommand(commandObjects.bfScanDump(key, iterator)); + } + + @Override + public Response bfLoadChunk(String key, long iterator, byte[] data) { + return appendCommand(commandObjects.bfLoadChunk(key, iterator, data)); + } + + @Override + public Response bfCard(String key) { + return appendCommand(commandObjects.bfCard(key)); + } + + @Override + public Response> bfInfo(String key) { + return appendCommand(commandObjects.bfInfo(key)); + } + + @Override + public Response cfReserve(String key, long capacity) { + return appendCommand(commandObjects.cfReserve(key, capacity)); + } + + @Override + public Response cfReserve(String key, long capacity, CFReserveParams reserveParams) { + return appendCommand(commandObjects.cfReserve(key, capacity, reserveParams)); + } + + @Override + public Response cfAdd(String key, String item) { + return appendCommand(commandObjects.cfAdd(key, item)); + } + + @Override + public Response cfAddNx(String key, String item) { + return appendCommand(commandObjects.cfAddNx(key, item)); + } + + @Override + public Response> cfInsert(String key, String... items) { + return appendCommand(commandObjects.cfInsert(key, items)); + } + + @Override + public Response> cfInsert(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsert(key, insertParams, items)); + } + + @Override + public Response> cfInsertNx(String key, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, items)); + } + + @Override + public Response> cfInsertNx(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, insertParams, items)); + } + + @Override + public Response cfExists(String key, String item) { + return appendCommand(commandObjects.cfExists(key, item)); + } + + @Override + public Response cfDel(String key, String item) { + return appendCommand(commandObjects.cfDel(key, item)); + } + + @Override + public Response cfCount(String key, String item) { + return appendCommand(commandObjects.cfCount(key, item)); + } + + @Override + public Response> cfScanDump(String key, long iterator) { + return appendCommand(commandObjects.cfScanDump(key, iterator)); + } + + @Override + public Response cfLoadChunk(String key, long iterator, byte[] data) { + return appendCommand(commandObjects.cfLoadChunk(key, iterator, data)); + } + + @Override + public Response> cfInfo(String key) { + return appendCommand(commandObjects.cfInfo(key)); + } + + @Override + public Response cmsInitByDim(String key, long width, long depth) { + return appendCommand(commandObjects.cmsInitByDim(key, width, depth)); + } + + @Override + public Response cmsInitByProb(String key, double error, double probability) { + return appendCommand(commandObjects.cmsInitByProb(key, error, probability)); + } + + @Override + public Response> cmsIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.cmsIncrBy(key, itemIncrements)); + } + + @Override + public Response> cmsQuery(String key, String... items) { + return appendCommand(commandObjects.cmsQuery(key, items)); + } + + @Override + public Response cmsMerge(String destKey, String... keys) { + return appendCommand(commandObjects.cmsMerge(destKey, keys)); + } + + @Override + public Response cmsMerge(String destKey, Map keysAndWeights) { + return appendCommand(commandObjects.cmsMerge(destKey, keysAndWeights)); + } + + @Override + public Response> cmsInfo(String key) { + return appendCommand(commandObjects.cmsInfo(key)); + } + + @Override + public Response topkReserve(String key, long topk) { + return appendCommand(commandObjects.topkReserve(key, topk)); + } + + @Override + public Response topkReserve(String key, long topk, long width, long depth, double decay) { + return appendCommand(commandObjects.topkReserve(key, topk, width, depth, decay)); + } + + @Override + public Response> topkAdd(String key, String... items) { + return appendCommand(commandObjects.topkAdd(key, items)); + } + + @Override + public Response> topkIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.topkIncrBy(key, itemIncrements)); + } + + @Override + public Response> topkQuery(String key, String... items) { + return appendCommand(commandObjects.topkQuery(key, items)); + } + + @Override + public Response> topkList(String key) { + return appendCommand(commandObjects.topkList(key)); + } + + @Override + public Response> topkListWithCount(String key) { + return appendCommand(commandObjects.topkListWithCount(key)); + } + + @Override + public Response> topkInfo(String key) { + return appendCommand(commandObjects.topkInfo(key)); + } + + @Override + public Response tdigestCreate(String key) { + return appendCommand(commandObjects.tdigestCreate(key)); + } + + @Override + public Response tdigestCreate(String key, int compression) { + return appendCommand(commandObjects.tdigestCreate(key, compression)); + } + + @Override + public Response tdigestReset(String key) { + return appendCommand(commandObjects.tdigestReset(key)); + } + + @Override + public Response tdigestMerge(String destinationKey, String... sourceKeys) { + return appendCommand(commandObjects.tdigestMerge(destinationKey, sourceKeys)); + } + + @Override + public Response tdigestMerge(TDigestMergeParams mergeParams, String destinationKey, String... sourceKeys) { + return appendCommand(commandObjects.tdigestMerge(mergeParams, destinationKey, sourceKeys)); + } + + @Override + public Response> tdigestInfo(String key) { + return appendCommand(commandObjects.tdigestInfo(key)); + } + + @Override + public Response tdigestAdd(String key, double... values) { + return appendCommand(commandObjects.tdigestAdd(key, values)); + } + + @Override + public Response> tdigestCDF(String key, double... values) { + return appendCommand(commandObjects.tdigestCDF(key, values)); + } + + @Override + public Response> tdigestQuantile(String key, double... quantiles) { + return appendCommand(commandObjects.tdigestQuantile(key, quantiles)); + } + + @Override + public Response tdigestMin(String key) { + return appendCommand(commandObjects.tdigestMin(key)); + } + + @Override + public Response tdigestMax(String key) { + return appendCommand(commandObjects.tdigestMax(key)); + } + + @Override + public Response tdigestTrimmedMean(String key, double lowCutQuantile, double highCutQuantile) { + return appendCommand(commandObjects.tdigestTrimmedMean(key, lowCutQuantile, highCutQuantile)); + } + + @Override + public Response> tdigestRank(String key, double... values) { + return appendCommand(commandObjects.tdigestRank(key, values)); + } + + @Override + public Response> tdigestRevRank(String key, double... values) { + return appendCommand(commandObjects.tdigestRevRank(key, values)); + } + + @Override + public Response> tdigestByRank(String key, long... ranks) { + return appendCommand(commandObjects.tdigestByRank(key, ranks)); + } + + @Override + public Response> tdigestByRevRank(String key, long... ranks) { + return appendCommand(commandObjects.tdigestByRevRank(key, ranks)); + } + // RedisBloom commands + + // RedisGraph commands + @Override + public Response graphQuery(String name, String query) { + return appendCommand(graphCommandObjects.graphQuery(name, query)); + } + + @Override + public Response graphReadonlyQuery(String name, String query) { + return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query)); + } + + @Override + public Response graphQuery(String name, String query, long timeout) { + return appendCommand(graphCommandObjects.graphQuery(name, query, timeout)); + } + + @Override + public Response graphReadonlyQuery(String name, String query, long timeout) { + return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, timeout)); + } + + @Override + public Response graphQuery(String name, String query, Map params) { + return appendCommand(graphCommandObjects.graphQuery(name, query, params)); + } + + @Override + public Response graphReadonlyQuery(String name, String query, Map params) { + return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, params)); + } + + @Override + public Response graphQuery(String name, String query, Map params, long timeout) { + return appendCommand(graphCommandObjects.graphQuery(name, query, params, timeout)); + } + + @Override + public Response graphReadonlyQuery(String name, String query, Map params, long timeout) { + return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, params, timeout)); + } + + @Override + public Response graphDelete(String name) { + return appendCommand(graphCommandObjects.graphDelete(name)); + } + + @Override + public Response> graphProfile(String graphName, String query) { + return appendCommand(commandObjects.graphProfile(graphName, query)); + } + // RedisGraph commands + + public Response sendCommand(ProtocolCommand cmd, String... args) { + return sendCommand(new CommandArguments(cmd).addObjects((Object[]) args)); + } + + public Response sendCommand(ProtocolCommand cmd, byte[]... args) { + return sendCommand(new CommandArguments(cmd).addObjects((Object[]) args)); + } + + public Response sendCommand(CommandArguments args) { + return executeCommand(new CommandObject<>(args, BuilderFactory.RAW_OBJECT)); + } + + public Response executeCommand(CommandObject command) { + return appendCommand(command); + } + + public void setJsonObjectMapper(JsonObjectMapper jsonObjectMapper) { + this.commandObjects.setJsonObjectMapper(jsonObjectMapper); + } +} diff --git a/src/main/java/redis/clients/jedis/Protocol.java b/src/main/java/redis/clients/jedis/Protocol.java index 3f273877b5..234b73bda9 100644 --- a/src/main/java/redis/clients/jedis/Protocol.java +++ b/src/main/java/redis/clients/jedis/Protocol.java @@ -272,7 +272,7 @@ public static enum Command implements ProtocolCommand { SSUBSCRIBE, SUNSUBSCRIBE, SPUBLISH, // <-- pub sub SAVE, BGSAVE, BGREWRITEAOF, LASTSAVE, PERSIST, ROLE, FAILOVER, SLOWLOG, OBJECT, CLIENT, TIME, SCAN, HSCAN, SSCAN, ZSCAN, WAIT, CLUSTER, ASKING, READONLY, READWRITE, SLAVEOF, REPLICAOF, COPY, - SENTINEL, MODULE, ACL, TOUCH, MEMORY, LOLWUT, COMMAND, LATENCY, WAITAOF; + SENTINEL, MODULE, ACL, TOUCH, MEMORY, LOLWUT, COMMAND, RESET, LATENCY, WAITAOF; private final byte[] raw; @@ -357,7 +357,7 @@ public static enum ClusterKeyword implements Rawable { MEET, RESET, INFO, FAILOVER, SLOTS, NODES, REPLICAS, SLAVES, MYID, ADDSLOTS, DELSLOTS, GETKEYSINSLOT, SETSLOT, NODE, MIGRATING, IMPORTING, STABLE, FORGET, FLUSHSLOTS, KEYSLOT, COUNTKEYSINSLOT, SAVECONFIG, REPLICATE, LINKS, ADDSLOTSRANGE, DELSLOTSRANGE, BUMPEPOCH, - MYSHARDID; + MYSHARDID, SHARDS; private final byte[] raw; diff --git a/src/main/java/redis/clients/jedis/ReliableTransaction.java b/src/main/java/redis/clients/jedis/ReliableTransaction.java index a0db77a068..c750bdb9d9 100644 --- a/src/main/java/redis/clients/jedis/ReliableTransaction.java +++ b/src/main/java/redis/clients/jedis/ReliableTransaction.java @@ -1,7 +1,20 @@ package redis.clients.jedis; +import static redis.clients.jedis.Protocol.Command.DISCARD; +import static redis.clients.jedis.Protocol.Command.EXEC; +import static redis.clients.jedis.Protocol.Command.MULTI; +import static redis.clients.jedis.Protocol.Command.UNWATCH; +import static redis.clients.jedis.Protocol.Command.WATCH; + +import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; +import java.util.Queue; + +import redis.clients.jedis.exceptions.JedisConnectionException; +import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.exceptions.JedisException; +import redis.clients.jedis.graph.GraphCommandObjects; /** * ReliableTransaction is a transaction where commands are immediately sent to Redis server and the @@ -11,6 +24,14 @@ public class ReliableTransaction extends TransactionBase { private static final String QUEUED_STR = "QUEUED"; + private final Queue> pipelinedResponses = new LinkedList<>(); + protected final Connection connection; + private final boolean closeConnection; + + private boolean broken = false; + private boolean inWatch = false; + private boolean inMulti = false; + /** * Creates a new transaction. * @@ -18,7 +39,7 @@ public class ReliableTransaction extends TransactionBase { * @param connection connection */ public ReliableTransaction(Connection connection) { - super(connection); + this(connection, true); } /** @@ -31,7 +52,7 @@ public ReliableTransaction(Connection connection) { * @param doMulti {@code false} should be set to enable manual WATCH, UNWATCH and MULTI */ public ReliableTransaction(Connection connection, boolean doMulti) { - super(connection, doMulti); + this(connection, doMulti, false); } /** @@ -45,41 +66,141 @@ public ReliableTransaction(Connection connection, boolean doMulti) { * @param closeConnection should the 'connection' be closed when 'close()' is called? */ public ReliableTransaction(Connection connection, boolean doMulti, boolean closeConnection) { - super(connection, doMulti, closeConnection); + this.connection = connection; + this.closeConnection = closeConnection; + setGraphCommands(new GraphCommandObjects(this.connection)); + if (doMulti) multi(); } @Override - protected final void processMultiResponse() { + public final void multi() { + connection.sendCommand(MULTI); String status = connection.getStatusCodeReply(); if (!"OK".equals(status)) { throw new JedisException("MULTI command failed. Received response: " + status); } + inMulti = true; + } + + @Override + public String watch(final String... keys) { + connection.sendCommand(WATCH, keys); + String status = connection.getStatusCodeReply(); + inWatch = true; + return status; } @Override - protected final void processAppendStatus() { + public String watch(final byte[]... keys) { + connection.sendCommand(WATCH, keys); + String status = connection.getStatusCodeReply(); + inWatch = true; + return status; + } + + @Override + public String unwatch() { + connection.sendCommand(UNWATCH); + String status = connection.getStatusCodeReply(); + inWatch = false; + return status; + } + + @Override + protected final Response appendCommand(CommandObject commandObject) { + connection.sendCommand(commandObject.getArguments()); String status = connection.getStatusCodeReply(); if (!QUEUED_STR.equals(status)) { throw new JedisException(status); } + Response response = new Response<>(commandObject.getBuilder()); + pipelinedResponses.add(response); + return response; } @Override - protected final void processPipelinedResponses(int pipelineLength) { - // do nothing + public final void close() { + try { + clear(); + } finally { + if (closeConnection) { + connection.close(); + } + } + } + + @Deprecated // TODO: private + public final void clear() { + if (broken) { + return; + } + if (inMulti) { + discard(); + } else if (inWatch) { + unwatch(); + } } @Override - public final List exec() { - return super.exec(); + public List exec() { + if (!inMulti) { + throw new IllegalStateException("EXEC without MULTI"); + } + + try { + // processPipelinedResponses(pipelinedResponses.size()); + // do nothing + connection.sendCommand(EXEC); + + List unformatted = connection.getObjectMultiBulkReply(); + if (unformatted == null) { + pipelinedResponses.clear(); + return null; + } + + List formatted = new ArrayList<>(unformatted.size()); + for (Object o : unformatted) { + try { + Response response = pipelinedResponses.poll(); + response.set(o); + formatted.add(response.get()); + } catch (JedisDataException e) { + formatted.add(e); + } + } + return formatted; + } catch (JedisConnectionException jce) { + broken = true; + throw jce; + } finally { + inMulti = false; + inWatch = false; + pipelinedResponses.clear(); + } } @Override - public final String discard() { - String status = super.discard(); - if (!"OK".equals(status)) { - throw new JedisException("DISCARD command failed. Received response: " + status); + public String discard() { + if (!inMulti) { + throw new IllegalStateException("DISCARD without MULTI"); + } + + try { + // processPipelinedResponses(pipelinedResponses.size()); + // do nothing + connection.sendCommand(DISCARD); + String status = connection.getStatusCodeReply(); + if (!"OK".equals(status)) { + throw new JedisException("DISCARD command failed. Received response: " + status); + } + return status; + } catch (JedisConnectionException jce) { + broken = true; + throw jce; + } finally { + inMulti = false; + inWatch = false; + pipelinedResponses.clear(); } - return status; } } diff --git a/src/main/java/redis/clients/jedis/StreamEntryID.java b/src/main/java/redis/clients/jedis/StreamEntryID.java index 66683d9038..9644010d7c 100644 --- a/src/main/java/redis/clients/jedis/StreamEntryID.java +++ b/src/main/java/redis/clients/jedis/StreamEntryID.java @@ -55,8 +55,8 @@ public int hashCode() { @Override public int compareTo(StreamEntryID other) { - int timeComapre = Long.compare(this.time, other.time); - return timeComapre != 0 ? timeComapre : Long.compare(this.sequence, other.sequence); + int timeCompare = Long.compare(this.time, other.time); + return timeCompare != 0 ? timeCompare : Long.compare(this.sequence, other.sequence); } public long getTime() { diff --git a/src/main/java/redis/clients/jedis/Transaction.java b/src/main/java/redis/clients/jedis/Transaction.java index a799ae3da9..0dccd655a0 100644 --- a/src/main/java/redis/clients/jedis/Transaction.java +++ b/src/main/java/redis/clients/jedis/Transaction.java @@ -1,18 +1,40 @@ package redis.clients.jedis; +import static redis.clients.jedis.Protocol.Command.DISCARD; +import static redis.clients.jedis.Protocol.Command.EXEC; +import static redis.clients.jedis.Protocol.Command.MULTI; +import static redis.clients.jedis.Protocol.Command.UNWATCH; +import static redis.clients.jedis.Protocol.Command.WATCH; + +import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; +import java.util.Queue; + +import redis.clients.jedis.exceptions.JedisConnectionException; +import redis.clients.jedis.exceptions.JedisDataException; +import redis.clients.jedis.graph.GraphCommandObjects; /** * A pipeline based transaction. */ public class Transaction extends TransactionBase { - private final Jedis jedis; + private final Queue> pipelinedResponses = new LinkedList<>(); + + private Jedis jedis = null; + + protected final Connection connection; + private final boolean closeConnection; + + private boolean broken = false; + private boolean inWatch = false; + private boolean inMulti = false; // Legacy - to support Jedis.multi() // TODO: Should be package private ?? public Transaction(Jedis jedis) { - super(jedis.getConnection()); + this(jedis.getConnection()); this.jedis = jedis; } @@ -24,8 +46,7 @@ public Transaction(Jedis jedis) { * @param connection connection */ public Transaction(Connection connection) { - super(connection); - this.jedis = null; + this(connection, true); } /** @@ -38,8 +59,7 @@ public Transaction(Connection connection) { * @param doMulti {@code false} should be set to enable manual WATCH, UNWATCH and MULTI */ public Transaction(Connection connection, boolean doMulti) { - super(connection, doMulti); - this.jedis = null; + this(connection, doMulti, false); } /** @@ -53,49 +73,142 @@ public Transaction(Connection connection, boolean doMulti) { * @param closeConnection should the 'connection' be closed when 'close()' is called? */ public Transaction(Connection connection, boolean doMulti, boolean closeConnection) { - super(connection, doMulti, closeConnection); - this.jedis = null; + this.connection = connection; + this.closeConnection = closeConnection; + setGraphCommands(new GraphCommandObjects(this.connection)); + if (doMulti) multi(); } @Override - protected final void processMultiResponse() { - // do nothing + public final void multi() { + connection.sendCommand(MULTI); + // processMultiResponse(); // do nothing + inMulti = true; } @Override - protected final void processAppendStatus() { - // do nothing + public String watch(final String... keys) { + connection.sendCommand(WATCH, keys); + String status = connection.getStatusCodeReply(); + inWatch = true; + return status; } @Override - protected final void processPipelinedResponses(int pipelineLength) { - // ignore QUEUED or ERROR - connection.getMany(1 + pipelineLength); + public String watch(final byte[]... keys) { + connection.sendCommand(WATCH, keys); + String status = connection.getStatusCodeReply(); + inWatch = true; + return status; } @Override - public final List exec() { - List ret; + public String unwatch() { + connection.sendCommand(UNWATCH); + String status = connection.getStatusCodeReply(); + inWatch = false; + return status; + } + + @Override + protected final Response appendCommand(CommandObject commandObject) { + connection.sendCommand(commandObject.getArguments()); + // processAppendStatus(); // do nothing + Response response = new Response<>(commandObject.getBuilder()); + pipelinedResponses.add(response); + return response; + } + + @Override + public final void close() { try { - ret = super.exec(); + clear(); } finally { + if (closeConnection) { + connection.close(); + } + } + } + + @Deprecated // TODO: private + public final void clear() { + if (broken) { + return; + } + if (inMulti) { + discard(); + } else if (inWatch) { + unwatch(); + } + } + + @Override + public List exec() { + if (!inMulti) { + throw new IllegalStateException("EXEC without MULTI"); + } + + try { + // ignore QUEUED (or ERROR) + // processPipelinedResponses(pipelinedResponses.size()); + connection.getMany(1 + pipelinedResponses.size()); + + connection.sendCommand(EXEC); + + List unformatted = connection.getObjectMultiBulkReply(); + if (unformatted == null) { + pipelinedResponses.clear(); + return null; + } + + List formatted = new ArrayList<>(unformatted.size()); + for (Object o : unformatted) { + try { + Response response = pipelinedResponses.poll(); + response.set(o); + formatted.add(response.get()); + } catch (JedisDataException e) { + formatted.add(e); + } + } + return formatted; + } catch (JedisConnectionException jce) { + broken = true; + throw jce; + } finally { + inMulti = false; + inWatch = false; + pipelinedResponses.clear(); if (jedis != null) { jedis.resetState(); } } - return ret; } @Override - public final String discard() { - String ret; + public String discard() { + if (!inMulti) { + throw new IllegalStateException("DISCARD without MULTI"); + } + try { - ret = super.discard(); + // ignore QUEUED (or ERROR) + // processPipelinedResponses(pipelinedResponses.size()); + connection.getMany(1 + pipelinedResponses.size()); + + connection.sendCommand(DISCARD); + + return connection.getStatusCodeReply(); + } catch (JedisConnectionException jce) { + broken = true; + throw jce; } finally { + inMulti = false; + inWatch = false; + pipelinedResponses.clear(); if (jedis != null) { jedis.resetState(); } } - return ret; } } diff --git a/src/main/java/redis/clients/jedis/TransactionBase.java b/src/main/java/redis/clients/jedis/TransactionBase.java index f6a21560ee..805a1120c4 100644 --- a/src/main/java/redis/clients/jedis/TransactionBase.java +++ b/src/main/java/redis/clients/jedis/TransactionBase.java @@ -1,4391 +1,12 @@ package redis.clients.jedis; -import static redis.clients.jedis.Protocol.Command.DISCARD; -import static redis.clients.jedis.Protocol.Command.EXEC; -import static redis.clients.jedis.Protocol.Command.MULTI; -import static redis.clients.jedis.Protocol.Command.UNWATCH; -import static redis.clients.jedis.Protocol.Command.WATCH; - -import java.io.Closeable; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import org.json.JSONArray; - -import redis.clients.jedis.args.*; -import redis.clients.jedis.bloom.*; -import redis.clients.jedis.commands.PipelineBinaryCommands; -import redis.clients.jedis.commands.PipelineCommands; -import redis.clients.jedis.commands.ProtocolCommand; -import redis.clients.jedis.commands.RedisModulePipelineCommands; -import redis.clients.jedis.exceptions.JedisConnectionException; -import redis.clients.jedis.exceptions.JedisDataException; -import redis.clients.jedis.graph.GraphCommandObjects; -import redis.clients.jedis.graph.ResultSet; -import redis.clients.jedis.json.JsonSetParams; -import redis.clients.jedis.json.Path; -import redis.clients.jedis.json.Path2; -import redis.clients.jedis.json.JsonObjectMapper; -import redis.clients.jedis.params.*; -import redis.clients.jedis.resps.*; -import redis.clients.jedis.search.*; -import redis.clients.jedis.search.aggr.AggregationBuilder; -import redis.clients.jedis.search.aggr.AggregationResult; -import redis.clients.jedis.search.schemafields.SchemaField; -import redis.clients.jedis.timeseries.*; -import redis.clients.jedis.util.KeyValue; - -public abstract class TransactionBase implements PipelineCommands, PipelineBinaryCommands, - RedisModulePipelineCommands, Closeable { - - private final Queue> pipelinedResponses = new LinkedList<>(); - protected final Connection connection; - private final boolean closeConnection; - private final CommandObjects commandObjects; - private final GraphCommandObjects graphCommandObjects; - - private boolean broken = false; - private boolean inWatch = false; - private boolean inMulti = false; - - /** - * Creates a new transaction. - * - * A MULTI command will be added to be sent to server. WATCH/UNWATCH/MULTI commands must not be - * called with this object. - * @param connection connection - */ - public TransactionBase(Connection connection) { - this(connection, true); - } - - /** - * Creates a new transaction. - * - * A user wanting to WATCH/UNWATCH keys followed by a call to MULTI ({@link #multi()}) it should - * be {@code doMulti=false}. - * - * @param connection connection - * @param doMulti {@code false} should be set to enable manual WATCH, UNWATCH and MULTI - */ - public TransactionBase(Connection connection, boolean doMulti) { - this(connection, doMulti, false); - } - - /** - * Creates a new transaction. - * - * A user wanting to WATCH/UNWATCH keys followed by a call to MULTI ({@link #multi()}) it should - * be {@code doMulti=false}. - * - * @param connection connection - * @param doMulti {@code false} should be set to enable manual WATCH, UNWATCH and MULTI - * @param closeConnection should the 'connection' be closed when 'close()' is called? - */ - public TransactionBase(Connection connection, boolean doMulti, boolean closeConnection) { - this.connection = connection; - this.closeConnection = closeConnection; - this.commandObjects = new CommandObjects(); - this.graphCommandObjects = new GraphCommandObjects(this.connection); - if (doMulti) multi(); - } - - public final void multi() { - connection.sendCommand(MULTI); - processMultiResponse(); - inMulti = true; - } - - public String watch(final String... keys) { - connection.sendCommand(WATCH, keys); - String status = connection.getStatusCodeReply(); - inWatch = true; - return status; - } - - public String watch(final byte[]... keys) { - connection.sendCommand(WATCH, keys); - String status = connection.getStatusCodeReply(); - inWatch = true; - return status; - } - - public String unwatch() { - connection.sendCommand(UNWATCH); - String status = connection.getStatusCodeReply(); - inWatch = false; - return status; - } - - protected abstract void processMultiResponse(); - - protected abstract void processAppendStatus(); - - protected final Response appendCommand(CommandObject commandObject) { - connection.sendCommand(commandObject.getArguments()); - processAppendStatus(); - Response response = new Response<>(commandObject.getBuilder()); - pipelinedResponses.add(response); - return response; - } - - @Override - public final void close() { - try { - clear(); - } finally { - if (closeConnection) { - connection.close(); - } - } - } - - public final void clear() { - if (broken) { - return; - } - if (inMulti) { - discard(); - } else if (inWatch) { - unwatch(); - } - } - - protected abstract void processPipelinedResponses(int pipelineLength); - - public List exec() { - if (!inMulti) { - throw new IllegalStateException("EXEC without MULTI"); - } - - try { - processPipelinedResponses(pipelinedResponses.size()); - connection.sendCommand(EXEC); - - List unformatted = connection.getObjectMultiBulkReply(); - if (unformatted == null) { - pipelinedResponses.clear(); - return null; - } - - List formatted = new ArrayList<>(unformatted.size()); - for (Object o : unformatted) { - try { - Response response = pipelinedResponses.poll(); - response.set(o); - formatted.add(response.get()); - } catch (JedisDataException e) { - formatted.add(e); - } - } - return formatted; - } catch (JedisConnectionException jce) { - broken = true; - throw jce; - } finally { - inMulti = false; - inWatch = false; - pipelinedResponses.clear(); - } - } - - public String discard() { - if (!inMulti) { - throw new IllegalStateException("DISCARD without MULTI"); - } - - try { - processPipelinedResponses(pipelinedResponses.size()); - connection.sendCommand(DISCARD); - return connection.getStatusCodeReply(); - } catch (JedisConnectionException jce) { - broken = true; - throw jce; - } finally { - inMulti = false; - inWatch = false; - pipelinedResponses.clear(); - } - } - - @Override - public Response exists(String key) { - return appendCommand(commandObjects.exists(key)); - } - - @Override - public Response exists(String... keys) { - return appendCommand(commandObjects.exists(keys)); - } - - @Override - public Response persist(String key) { - return appendCommand(commandObjects.persist(key)); - } - - @Override - public Response type(String key) { - return appendCommand(commandObjects.type(key)); - } - - @Override - public Response dump(String key) { - return appendCommand(commandObjects.dump(key)); - } - - @Override - public Response restore(String key, long ttl, byte[] serializedValue) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue)); - } - - @Override - public Response restore(String key, long ttl, byte[] serializedValue, RestoreParams params) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue, params)); - } - - @Override - public Response expire(String key, long seconds) { - return appendCommand(commandObjects.expire(key, seconds)); - } - - @Override - public Response expire(String key, long seconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expire(key, seconds, expiryOption)); - } - - @Override - public Response pexpire(String key, long milliseconds) { - return appendCommand(commandObjects.pexpire(key, milliseconds)); - } - - @Override - public Response pexpire(String key, long milliseconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpire(key, milliseconds, expiryOption)); - } - - @Override - public Response expireTime(String key) { - return appendCommand(commandObjects.expireTime(key)); - } - - @Override - public Response pexpireTime(String key) { - return appendCommand(commandObjects.pexpireTime(key)); - } - - @Override - public Response expireAt(String key, long unixTime) { - return appendCommand(commandObjects.expireAt(key, unixTime)); - } - - @Override - public Response expireAt(String key, long unixTime, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expireAt(key, unixTime, expiryOption)); - } - - @Override - public Response pexpireAt(String key, long millisecondsTimestamp) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp)); - } - - @Override - public Response pexpireAt(String key, long millisecondsTimestamp, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp, expiryOption)); - } - - @Override - public Response ttl(String key) { - return appendCommand(commandObjects.ttl(key)); - } - - @Override - public Response pttl(String key) { - return appendCommand(commandObjects.pttl(key)); - } - - @Override - public Response touch(String key) { - return appendCommand(commandObjects.touch(key)); - } - - @Override - public Response touch(String... keys) { - return appendCommand(commandObjects.touch(keys)); - } - - @Override - public Response> sort(String key) { - return appendCommand(commandObjects.sort(key)); - } - - @Override - public Response sort(String key, String dstKey) { - return appendCommand(commandObjects.sort(key, dstKey)); - } - - @Override - public Response> sort(String key, SortingParams sortingParams) { - return appendCommand(commandObjects.sort(key, sortingParams)); - } - - @Override - public Response sort(String key, SortingParams sortingParams, String dstKey) { - return appendCommand(commandObjects.sort(key, sortingParams, dstKey)); - } - - @Override - public Response> sortReadonly(String key, SortingParams sortingParams) { - return appendCommand(commandObjects.sortReadonly(key, sortingParams)); - } - - @Override - public Response del(String key) { - return appendCommand(commandObjects.del(key)); - } - - @Override - public Response del(String... keys) { - return appendCommand(commandObjects.del(keys)); - } - - @Override - public Response unlink(String key) { - return appendCommand(commandObjects.unlink(key)); - } - - @Override - public Response unlink(String... keys) { - return appendCommand(commandObjects.unlink(keys)); - } - - @Override - public Response copy(String srcKey, String dstKey, boolean replace) { - return appendCommand(commandObjects.copy(srcKey, dstKey, replace)); - } - - @Override - public Response rename(String oldkey, String newkey) { - return appendCommand(commandObjects.rename(oldkey, newkey)); - } - - @Override - public Response renamenx(String oldkey, String newkey) { - return appendCommand(commandObjects.renamenx(oldkey, newkey)); - } - - @Override - public Response memoryUsage(String key) { - return appendCommand(commandObjects.memoryUsage(key)); - } - - @Override - public Response memoryUsage(String key, int samples) { - return appendCommand(commandObjects.memoryUsage(key, samples)); - } - - @Override - public Response objectRefcount(String key) { - return appendCommand(commandObjects.objectRefcount(key)); - } - - @Override - public Response objectEncoding(String key) { - return appendCommand(commandObjects.objectEncoding(key)); - } - - @Override - public Response objectIdletime(String key) { - return appendCommand(commandObjects.objectIdletime(key)); - } - - @Override - public Response objectFreq(String key) { - return appendCommand(commandObjects.objectFreq(key)); - } - - @Override - public Response migrate(String host, int port, String key, int timeout) { - return appendCommand(commandObjects.migrate(host, port, key, timeout)); - } - - @Override - public Response migrate(String host, int port, int timeout, MigrateParams params, String... keys) { - return appendCommand(commandObjects.migrate(host, port, timeout, params, keys)); - } - - @Override - public Response> keys(String pattern) { - return appendCommand(commandObjects.keys(pattern)); - } - - @Override - public Response> scan(String cursor) { - return appendCommand(commandObjects.scan(cursor)); - } - - @Override - public Response> scan(String cursor, ScanParams params) { - return appendCommand(commandObjects.scan(cursor, params)); - } - - @Override - public Response> scan(String cursor, ScanParams params, String type) { - return appendCommand(commandObjects.scan(cursor, params, type)); - } - - @Override - public Response randomKey() { - return appendCommand(commandObjects.randomKey()); - } - - @Override - public Response get(String key) { - return appendCommand(commandObjects.get(key)); - } - - @Override - public Response setGet(String key, String value, SetParams params) { - return appendCommand(commandObjects.setGet(key, value, params)); - } - - @Override - public Response getDel(String key) { - return appendCommand(commandObjects.getDel(key)); - } - - @Override - public Response getEx(String key, GetExParams params) { - return appendCommand(commandObjects.getEx(key, params)); - } - - @Override - public Response setbit(String key, long offset, boolean value) { - return appendCommand(commandObjects.setbit(key, offset, value)); - } - - @Override - public Response getbit(String key, long offset) { - return appendCommand(commandObjects.getbit(key, offset)); - } - - @Override - public Response setrange(String key, long offset, String value) { - return appendCommand(commandObjects.setrange(key, offset, value)); - } - - @Override - public Response getrange(String key, long startOffset, long endOffset) { - return appendCommand(commandObjects.getrange(key, startOffset, endOffset)); - } - - @Override - public Response getSet(String key, String value) { - return appendCommand(commandObjects.getSet(key, value)); - } - - @Override - public Response setnx(String key, String value) { - return appendCommand(commandObjects.setnx(key, value)); - } - - @Override - public Response setex(String key, long seconds, String value) { - return appendCommand(commandObjects.setex(key, seconds, value)); - } - - @Override - public Response psetex(String key, long milliseconds, String value) { - return appendCommand(commandObjects.psetex(key, milliseconds, value)); - } - - @Override - public Response> mget(String... keys) { - return appendCommand(commandObjects.mget(keys)); - } - - @Override - public Response mset(String... keysvalues) { - return appendCommand(commandObjects.mset(keysvalues)); - } - - @Override - public Response msetnx(String... keysvalues) { - return appendCommand(commandObjects.msetnx(keysvalues)); - } - - @Override - public Response incr(String key) { - return appendCommand(commandObjects.incr(key)); - } - - @Override - public Response incrBy(String key, long increment) { - return appendCommand(commandObjects.incrBy(key, increment)); - } - - @Override - public Response incrByFloat(String key, double increment) { - return appendCommand(commandObjects.incrByFloat(key, increment)); - } - - @Override - public Response decr(String key) { - return appendCommand(commandObjects.decr(key)); - } - - @Override - public Response decrBy(String key, long decrement) { - return appendCommand(commandObjects.decrBy(key, decrement)); - } - - @Override - public Response append(String key, String value) { - return appendCommand(commandObjects.append(key, value)); - } - - @Override - public Response substr(String key, int start, int end) { - return appendCommand(commandObjects.substr(key, start, end)); - } - - @Override - public Response strlen(String key) { - return appendCommand(commandObjects.strlen(key)); - } - - @Override - public Response bitcount(String key) { - return appendCommand(commandObjects.bitcount(key)); - } - - @Override - public Response bitcount(String key, long start, long end) { - return appendCommand(commandObjects.bitcount(key, start, end)); - } - - @Override - public Response bitcount(String key, long start, long end, BitCountOption option) { - return appendCommand(commandObjects.bitcount(key, start, end, option)); - } - - @Override - public Response bitpos(String key, boolean value) { - return appendCommand(commandObjects.bitpos(key, value)); - } - - @Override - public Response bitpos(String key, boolean value, BitPosParams params) { - return appendCommand(commandObjects.bitpos(key, value, params)); - } - - @Override - public Response> bitfield(String key, String... arguments) { - return appendCommand(commandObjects.bitfield(key, arguments)); - } - - @Override - public Response> bitfieldReadonly(String key, String... arguments) { - return appendCommand(commandObjects.bitfieldReadonly(key, arguments)); - } - - @Override - public Response bitop(BitOP op, String destKey, String... srcKeys) { - return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); - } - - @Override - public Response lcs(String keyA, String keyB, LCSParams params) { - return appendCommand(commandObjects.lcs(keyA, keyB, params)); - } - - @Override - public Response set(String key, String value) { - return appendCommand(commandObjects.set(key, value)); - } - - @Override - public Response set(String key, String value, SetParams params) { - return appendCommand(commandObjects.set(key, value, params)); - } - - @Override - public Response rpush(String key, String... string) { - return appendCommand(commandObjects.rpush(key, string)); - - } - - @Override - public Response lpush(String key, String... string) { - return appendCommand(commandObjects.lpush(key, string)); - } - - @Override - public Response llen(String key) { - return appendCommand(commandObjects.llen(key)); - } - - @Override - public Response> lrange(String key, long start, long stop) { - return appendCommand(commandObjects.lrange(key, start, stop)); - } - - @Override - public Response ltrim(String key, long start, long stop) { - return appendCommand(commandObjects.ltrim(key, start, stop)); - } - - @Override - public Response lindex(String key, long index) { - return appendCommand(commandObjects.lindex(key, index)); - } - - @Override - public Response lset(String key, long index, String value) { - return appendCommand(commandObjects.lset(key, index, value)); - } - - @Override - public Response lrem(String key, long count, String value) { - return appendCommand(commandObjects.lrem(key, count, value)); - } - - @Override - public Response lpop(String key) { - return appendCommand(commandObjects.lpop(key)); - } - - @Override - public Response> lpop(String key, int count) { - return appendCommand(commandObjects.lpop(key, count)); - } - - @Override - public Response lpos(String key, String element) { - return appendCommand(commandObjects.lpos(key, element)); - } - - @Override - public Response lpos(String key, String element, LPosParams params) { - return appendCommand(commandObjects.lpos(key, element, params)); - } - - @Override - public Response> lpos(String key, String element, LPosParams params, long count) { - return appendCommand(commandObjects.lpos(key, element, params, count)); - } - - @Override - public Response rpop(String key) { - return appendCommand(commandObjects.rpop(key)); - } - - @Override - public Response> rpop(String key, int count) { - return appendCommand(commandObjects.rpop(key, count)); - } - - @Override - public Response linsert(String key, ListPosition where, String pivot, String value) { - return appendCommand(commandObjects.linsert(key, where, pivot, value)); - } - - @Override - public Response lpushx(String key, String... strings) { - return appendCommand(commandObjects.lpushx(key, strings)); - } - - @Override - public Response rpushx(String key, String... strings) { - return appendCommand(commandObjects.rpushx(key, strings)); - } - - @Override - public Response> blpop(int timeout, String key) { - return appendCommand(commandObjects.blpop(timeout, key)); - } - - @Override - public Response> blpop(double timeout, String key) { - return appendCommand(commandObjects.blpop(timeout, key)); - } - - @Override - public Response> brpop(int timeout, String key) { - return appendCommand(commandObjects.brpop(timeout, key)); - } - - @Override - public Response> brpop(double timeout, String key) { - return appendCommand(commandObjects.brpop(timeout, key)); - } - - @Override - public Response> blpop(int timeout, String... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> blpop(double timeout, String... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> brpop(int timeout, String... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response> brpop(double timeout, String... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response rpoplpush(String srcKey, String dstKey) { - return appendCommand(commandObjects.rpoplpush(srcKey, dstKey)); - } - - @Override - public Response brpoplpush(String source, String destination, int timeout) { - return appendCommand(commandObjects.brpoplpush(source, destination, timeout)); - } - - @Override - public Response lmove(String srcKey, String dstKey, ListDirection from, ListDirection to) { - return appendCommand(commandObjects.lmove(srcKey, dstKey, from, to)); - } - - @Override - public Response blmove(String srcKey, String dstKey, ListDirection from, ListDirection to, double timeout) { - return appendCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); - } - - @Override - public Response>> lmpop(ListDirection direction, String... keys) { - return appendCommand(commandObjects.lmpop(direction, keys)); - } - - @Override - public Response>> lmpop(ListDirection direction, int count, String... keys) { - return appendCommand(commandObjects.lmpop(direction, count, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, String... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, int count, String... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); - } - - @Override - public Response hset(String key, String field, String value) { - return appendCommand(commandObjects.hset(key, field, value)); - } - - @Override - public Response hset(String key, Map hash) { - return appendCommand(commandObjects.hset(key, hash)); - } - - @Override - public Response hget(String key, String field) { - return appendCommand(commandObjects.hget(key, field)); - } - - @Override - public Response hsetnx(String key, String field, String value) { - return appendCommand(commandObjects.hsetnx(key, field, value)); - } - - @Override - public Response hmset(String key, Map hash) { - return appendCommand(commandObjects.hmset(key, hash)); - } - - @Override - public Response> hmget(String key, String... fields) { - return appendCommand(commandObjects.hmget(key, fields)); - } - - @Override - public Response hincrBy(String key, String field, long value) { - return appendCommand(commandObjects.hincrBy(key, field, value)); - } - - @Override - public Response hincrByFloat(String key, String field, double value) { - return appendCommand(commandObjects.hincrByFloat(key, field, value)); - } - - @Override - public Response hexists(String key, String field) { - return appendCommand(commandObjects.hexists(key, field)); - } - - @Override - public Response hdel(String key, String... field) { - return appendCommand(commandObjects.hdel(key, field)); - } - - @Override - public Response hlen(String key) { - return appendCommand(commandObjects.hlen(key)); - } - - @Override - public Response> hkeys(String key) { - return appendCommand(commandObjects.hkeys(key)); - } - - @Override - public Response> hvals(String key) { - return appendCommand(commandObjects.hvals(key)); - } - - @Override - public Response> hgetAll(String key) { - return appendCommand(commandObjects.hgetAll(key)); - } - - @Override - public Response hrandfield(String key) { - return appendCommand(commandObjects.hrandfield(key)); - } - - @Override - public Response> hrandfield(String key, long count) { - return appendCommand(commandObjects.hrandfield(key, count)); - } - - @Override - public Response>> hrandfieldWithValues(String key, long count) { - return appendCommand(commandObjects.hrandfieldWithValues(key, count)); - } - - @Override - public Response>> hscan(String key, String cursor, ScanParams params) { - return appendCommand(commandObjects.hscan(key, cursor, params)); - } - - @Override - public Response hstrlen(String key, String field) { - return appendCommand(commandObjects.hstrlen(key, field)); - } - - @Override - public Response sadd(String key, String... members) { - return appendCommand(commandObjects.sadd(key, members)); - } - - @Override - public Response> smembers(String key) { - return appendCommand(commandObjects.smembers(key)); - } - - @Override - public Response srem(String key, String... members) { - return appendCommand(commandObjects.srem(key, members)); - } - - @Override - public Response spop(String key) { - return appendCommand(commandObjects.spop(key)); - } - - @Override - public Response> spop(String key, long count) { - return appendCommand(commandObjects.spop(key, count)); - } - - @Override - public Response scard(String key) { - return appendCommand(commandObjects.scard(key)); - } - - @Override - public Response sismember(String key, String member) { - return appendCommand(commandObjects.sismember(key, member)); - } - - @Override - public Response> smismember(String key, String... members) { - return appendCommand(commandObjects.smismember(key, members)); - } - - @Override - public Response srandmember(String key) { - return appendCommand(commandObjects.srandmember(key)); - } - - @Override - public Response> srandmember(String key, int count) { - return appendCommand(commandObjects.srandmember(key, count)); - } - - @Override - public Response> sscan(String key, String cursor, ScanParams params) { - return appendCommand(commandObjects.sscan(key, cursor, params)); - } - - @Override - public Response> sdiff(String... keys) { - return appendCommand(commandObjects.sdiff(keys)); - } - - @Override - public Response sdiffStore(String dstKey, String... keys) { - return appendCommand(commandObjects.sdiffstore(dstKey, keys)); - } - - @Override - public Response> sinter(String... keys) { - return appendCommand(commandObjects.sinter(keys)); - } - - @Override - public Response sinterstore(String dstKey, String... keys) { - return appendCommand(commandObjects.sinterstore(dstKey, keys)); - } - - @Override - public Response sintercard(String... keys) { - return appendCommand(commandObjects.sintercard(keys)); - } - - @Override - public Response sintercard(int limit, String... keys) { - return appendCommand(commandObjects.sintercard(limit, keys)); - } - - @Override - public Response> sunion(String... keys) { - return appendCommand(commandObjects.sunion(keys)); - } - - @Override - public Response sunionstore(String dstKey, String... keys) { - return appendCommand(commandObjects.sunionstore(dstKey, keys)); - } - - @Override - public Response smove(String srcKey, String dstKey, String member) { - return appendCommand(commandObjects.smove(srcKey, dstKey, member)); - } - - @Override - public Response zadd(String key, double score, String member) { - return appendCommand(commandObjects.zadd(key, score, member)); - } - - @Override - public Response zadd(String key, double score, String member, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, score, member, params)); - } - - @Override - public Response zadd(String key, Map scoreMembers) { - return appendCommand(commandObjects.zadd(key, scoreMembers)); - } - - @Override - public Response zadd(String key, Map scoreMembers, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, scoreMembers, params)); - } - - @Override - public Response zaddIncr(String key, double score, String member, ZAddParams params) { - return appendCommand(commandObjects.zaddIncr(key, score, member, params)); - } - - @Override - public Response zrem(String key, String... members) { - return appendCommand(commandObjects.zrem(key, members)); - } - - @Override - public Response zincrby(String key, double increment, String member) { - return appendCommand(commandObjects.zincrby(key, increment, member)); - } - - @Override - public Response zincrby(String key, double increment, String member, ZIncrByParams params) { - return appendCommand(commandObjects.zincrby(key, increment, member, params)); - } - - @Override - public Response zrank(String key, String member) { - return appendCommand(commandObjects.zrank(key, member)); - } - - @Override - public Response zrevrank(String key, String member) { - return appendCommand(commandObjects.zrevrank(key, member)); - } - - @Override - public Response> zrankWithScore(String key, String member) { - return appendCommand(commandObjects.zrankWithScore(key, member)); - } - - @Override - public Response> zrevrankWithScore(String key, String member) { - return appendCommand(commandObjects.zrevrankWithScore(key, member)); - } - - @Override - public Response> zrange(String key, long start, long stop) { - return appendCommand(commandObjects.zrange(key, start, stop)); - } - - @Override - public Response> zrevrange(String key, long start, long stop) { - return appendCommand(commandObjects.zrevrange(key, start, stop)); - } - - @Override - public Response> zrangeWithScores(String key, long start, long stop) { - return appendCommand(commandObjects.zrangeWithScores(key, start, stop)); - } - - @Override - public Response> zrevrangeWithScores(String key, long start, long stop) { - return appendCommand(commandObjects.zrevrangeWithScores(key, start, stop)); - } - - @Override - public Response> zrange(String key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrange(key, zRangeParams)); - } - - @Override - public Response> zrangeWithScores(String key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangeWithScores(key, zRangeParams)); - } - - @Override - public Response zrangestore(String dest, String src, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangestore(dest, src, zRangeParams)); - } - - @Override - public Response zrandmember(String key) { - return appendCommand(commandObjects.zrandmember(key)); - } - - @Override - public Response> zrandmember(String key, long count) { - return appendCommand(commandObjects.zrandmember(key, count)); - } - - @Override - public Response> zrandmemberWithScores(String key, long count) { - return appendCommand(commandObjects.zrandmemberWithScores(key, count)); - } - - @Override - public Response zcard(String key) { - return appendCommand(commandObjects.zcard(key)); - } - - @Override - public Response zscore(String key, String member) { - return appendCommand(commandObjects.zscore(key, member)); - } - - @Override - public Response> zmscore(String key, String... members) { - return appendCommand(commandObjects.zmscore(key, members)); - } - - @Override - public Response zpopmax(String key) { - return appendCommand(commandObjects.zpopmax(key)); - } - - @Override - public Response> zpopmax(String key, int count) { - return appendCommand(commandObjects.zpopmax(key, count)); - } - - @Override - public Response zpopmin(String key) { - return appendCommand(commandObjects.zpopmin(key)); - } - - @Override - public Response> zpopmin(String key, int count) { - return appendCommand(commandObjects.zpopmin(key, count)); - } - - @Override - public Response zcount(String key, double min, double max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response zcount(String key, String min, String max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response> zrangeByScore(String key, double min, double max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrangeByScore(String key, String min, String max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrevrangeByScore(String key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - - } - - @Override - public Response> zrangeByScore(String key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(String key, String max, String min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - } - - @Override - public Response> zrangeByScore(String key, String min, String max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(String key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, double min, double max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(String key, String max, String min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, String min, String max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, String max, String min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(String key, String min, String max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response zremrangeByRank(String key, long start, long stop) { - return appendCommand(commandObjects.zremrangeByRank(key, start, stop)); - } - - @Override - public Response zremrangeByScore(String key, double min, double max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zremrangeByScore(String key, String min, String max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zlexcount(String key, String min, String max) { - return appendCommand(commandObjects.zlexcount(key, min, max)); - } - - @Override - public Response> zrangeByLex(String key, String min, String max) { - return appendCommand(commandObjects.zrangeByLex(key, min, max)); - } - - @Override - public Response> zrangeByLex(String key, String min, String max, int offset, int count) { - return appendCommand(commandObjects.zrangeByLex(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByLex(String key, String max, String min) { - return appendCommand(commandObjects.zrevrangeByLex(key, max, min)); - } - - @Override - public Response> zrevrangeByLex(String key, String max, String min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByLex(key, max, min, offset, count)); - } - - @Override - public Response zremrangeByLex(String key, String min, String max) { - return appendCommand(commandObjects.zremrangeByLex(key, min, max)); - } - - @Override - public Response> zscan(String key, String cursor, ScanParams params) { - return appendCommand(commandObjects.zscan(key, cursor, params)); - } - - @Override - public Response> bzpopmax(double timeout, String... keys) { - return appendCommand(commandObjects.bzpopmax(timeout, keys)); - } - - @Override - public Response> bzpopmin(double timeout, String... keys) { - return appendCommand(commandObjects.bzpopmin(timeout, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, String... keys) { - return appendCommand(commandObjects.zmpop(option, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, int count, String... keys) { - return appendCommand(commandObjects.zmpop(option, count, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, String... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); - } - - @Override - public Response> zdiff(String... keys) { - return appendCommand(commandObjects.zdiff(keys)); - } - - @Override - public Response> zdiffWithScores(String... keys) { - return appendCommand(commandObjects.zdiffWithScores(keys)); - } - - @Override - @Deprecated - public Response zdiffStore(String dstKey, String... keys) { - return appendCommand(commandObjects.zdiffStore(dstKey, keys)); - } - - @Override - public Response zdiffstore(String dstKey, String... keys) { - return appendCommand(commandObjects.zdiffstore(dstKey, keys)); - } - - @Override - public Response zinterstore(String dstKey, String... sets) { - return appendCommand(commandObjects.zinterstore(dstKey, sets)); - } - - @Override - public Response zinterstore(String dstKey, ZParams params, String... sets) { - return appendCommand(commandObjects.zinterstore(dstKey, params, sets)); - } - - @Override - public Response> zinter(ZParams params, String... keys) { - return appendCommand(commandObjects.zinter(params, keys)); - } - - @Override - public Response> zinterWithScores(ZParams params, String... keys) { - return appendCommand(commandObjects.zinterWithScores(params, keys)); - } - - @Override - public Response zintercard(String... keys) { - return appendCommand(commandObjects.zintercard(keys)); - } - - @Override - public Response zintercard(long limit, String... keys) { - return appendCommand(commandObjects.zintercard(limit, keys)); - } - - @Override - public Response> zunion(ZParams params, String... keys) { - return appendCommand(commandObjects.zunion(params, keys)); - } - - @Override - public Response> zunionWithScores(ZParams params, String... keys) { - return appendCommand(commandObjects.zunionWithScores(params, keys)); - } - - @Override - public Response zunionstore(String dstKey, String... sets) { - return appendCommand(commandObjects.zunionstore(dstKey, sets)); - } - - @Override - public Response zunionstore(String dstKey, ZParams params, String... sets) { - return appendCommand(commandObjects.zunionstore(dstKey, params, sets)); - } - - @Override - public Response geoadd(String key, double longitude, double latitude, String member) { - return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); - } - - @Override - public Response geoadd(String key, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, memberCoordinateMap)); - } - - @Override - public Response geoadd(String key, GeoAddParams params, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); - } - - @Override - public Response geodist(String key, String member1, String member2) { - return appendCommand(commandObjects.geodist(key, member1, member2)); - } - - @Override - public Response geodist(String key, String member1, String member2, GeoUnit unit) { - return appendCommand(commandObjects.geodist(key, member1, member2, unit)); - } - - @Override - public Response> geohash(String key, String... members) { - return appendCommand(commandObjects.geohash(key, members)); - } - - @Override - public Response> geopos(String key, String... members) { - return appendCommand(commandObjects.geopos(key, members)); - } - - @Override - public Response> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusByMember(String key, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); - } - - @Override - public Response> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); - } - - @Override - public Response georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); - } - - @Override - public Response georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); - } - - @Override - public Response> geosearch(String key, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, radius, unit)); - } - - @Override - public Response> geosearch(String key, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, radius, unit)); - } - - @Override - public Response> geosearch(String key, String member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, width, height, unit)); - } - - @Override - public Response> geosearch(String key, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, width, height, unit)); - } - - @Override - public Response> geosearch(String key, GeoSearchParam params) { - return appendCommand(commandObjects.geosearch(key, params)); - } - - @Override - public Response geosearchStore(String dest, String src, String member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, radius, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, String member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); - } - - @Override - public Response geosearchStore(String dest, String src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStore(dest, src, params)); - } - - @Override - public Response geosearchStoreStoreDist(String dest, String src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStoreStoreDist(dest, src, params)); - } - - @Override - public Response pfadd(String key, String... elements) { - return appendCommand(commandObjects.pfadd(key, elements)); - } - - @Override - public Response pfmerge(String destkey, String... sourcekeys) { - return appendCommand(commandObjects.pfmerge(destkey, sourcekeys)); - } - - @Override - public Response pfcount(String key) { - return appendCommand(commandObjects.pfcount(key)); - } - - @Override - public Response pfcount(String... keys) { - return appendCommand(commandObjects.pfcount(keys)); - } - - @Override - public Response xadd(String key, StreamEntryID id, Map hash) { - return appendCommand(commandObjects.xadd(key, id, hash)); - } - - @Override - public Response xadd(String key, XAddParams params, Map hash) { - return appendCommand(commandObjects.xadd(key, params, hash)); - } - - @Override - public Response xlen(String key) { - return appendCommand(commandObjects.xlen(key)); - } - - @Override - public Response> xrange(String key, StreamEntryID start, StreamEntryID end) { - return appendCommand(commandObjects.xrange(key, start, end)); - } - - @Override - public Response> xrange(String key, StreamEntryID start, StreamEntryID end, int count) { - return appendCommand(commandObjects.xrange(key, start, end, count)); - } - - @Override - public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start) { - return appendCommand(commandObjects.xrevrange(key, start, end)); - } - - @Override - public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count) { - return appendCommand(commandObjects.xrevrange(key, start, end, count)); - } - - @Override - public Response> xrange(String key, String start, String end) { - return appendCommand(commandObjects.xrange(key, start, end)); - } - - @Override - public Response> xrange(String key, String start, String end, int count) { - return appendCommand(commandObjects.xrange(key, start, end, count)); - } - - @Override - public Response> xrevrange(String key, String end, String start) { - return appendCommand(commandObjects.xrevrange(key, start, end)); - } - - @Override - public Response> xrevrange(String key, String end, String start, int count) { - return appendCommand(commandObjects.xrevrange(key, start, end, count)); - } - - @Override - public Response xack(String key, String group, StreamEntryID... ids) { - return appendCommand(commandObjects.xack(key, group, ids)); - } - - @Override - public Response xgroupCreate(String key, String groupName, StreamEntryID id, boolean makeStream) { - return appendCommand(commandObjects.xgroupCreate(key, groupName, id, makeStream)); - } - - @Override - public Response xgroupSetID(String key, String groupName, StreamEntryID id) { - return appendCommand(commandObjects.xgroupSetID(key, groupName, id)); - } - - @Override - public Response xgroupDestroy(String key, String groupName) { - return appendCommand(commandObjects.xgroupDestroy(key, groupName)); - } - - @Override - public Response xgroupCreateConsumer(String key, String groupName, String consumerName) { - return appendCommand(commandObjects.xgroupCreateConsumer(key, groupName, consumerName)); - } - - @Override - public Response xgroupDelConsumer(String key, String groupName, String consumerName) { - return appendCommand(commandObjects.xgroupDelConsumer(key, groupName, consumerName)); - } - - @Override - public Response xpending(String key, String groupName) { - return appendCommand(commandObjects.xpending(key, groupName)); - } - - @Override - public Response> xpending(String key, String groupName, XPendingParams params) { - return appendCommand(commandObjects.xpending(key, groupName, params)); - } - - @Override - public Response xdel(String key, StreamEntryID... ids) { - return appendCommand(commandObjects.xdel(key, ids)); - } - - @Override - public Response xtrim(String key, long maxLen, boolean approximate) { - return appendCommand(commandObjects.xtrim(key, maxLen, approximate)); - } - - @Override - public Response xtrim(String key, XTrimParams params) { - return appendCommand(commandObjects.xtrim(key, params)); - } - - @Override - public Response> xclaim(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { - return appendCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response> xclaimJustId(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { - return appendCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response>> xautoclaim(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaim(key, group, consumerName, minIdleTime, start, params)); - } - - @Override - public Response>> xautoclaimJustId(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaimJustId(key, group, consumerName, minIdleTime, start, params)); - } - - @Override - public Response xinfoStream(String key) { - return appendCommand(commandObjects.xinfoStream(key)); - } - - @Override - public Response xinfoStreamFull(String key) { - return appendCommand(commandObjects.xinfoStreamFull(key)); - } - - @Override - public Response xinfoStreamFull(String key, int count) { - return appendCommand(commandObjects.xinfoStreamFull(key, count)); - } - - @Override - public Response> xinfoGroups(String key) { - return appendCommand(commandObjects.xinfoGroups(key)); - } - - @Override - public Response> xinfoConsumers(String key, String group) { - return appendCommand(commandObjects.xinfoConsumers(key, group)); - } - - @Override - public Response> xinfoConsumers2(String key, String group) { - return appendCommand(commandObjects.xinfoConsumers2(key, group)); - } - - @Override - public Response>>> xread(XReadParams xReadParams, Map streams) { - return appendCommand(commandObjects.xread(xReadParams, streams)); - } - - @Override - public Response>>> xreadGroup(String groupName, String consumer, XReadGroupParams xReadGroupParams, Map streams) { - return appendCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); - } - - @Override - public Response eval(String script) { - return appendCommand(commandObjects.eval(script)); - } - - @Override - public Response eval(String script, int keyCount, String... params) { - return appendCommand(commandObjects.eval(script, keyCount, params)); - } - - @Override - public Response eval(String script, List keys, List args) { - return appendCommand(commandObjects.eval(script, keys, args)); - } - - @Override - public Response evalReadonly(String script, List keys, List args) { - return appendCommand(commandObjects.evalReadonly(script, keys, args)); - } - - @Override - public Response evalsha(String sha1) { - return appendCommand(commandObjects.evalsha(sha1)); - } - - @Override - public Response evalsha(String sha1, int keyCount, String... params) { - return appendCommand(commandObjects.evalsha(sha1, keyCount, params)); - } - - @Override - public Response evalsha(String sha1, List keys, List args) { - return appendCommand(commandObjects.evalsha(sha1, keys, args)); - } - - @Override - public Response evalshaReadonly(String sha1, List keys, List args) { - return appendCommand(commandObjects.evalshaReadonly(sha1, keys, args)); - } - - - @Override - public Response waitReplicas(String sampleKey, int replicas, long timeout) { - return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); - } - - @Override - public Response> waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) { - return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); - } - - @Override - public Response eval(String script, String sampleKey) { - return appendCommand(commandObjects.eval(script, sampleKey)); - } - - @Override - public Response evalsha(String sha1, String sampleKey) { - return appendCommand(commandObjects.evalsha(sha1, sampleKey)); - } - - @Override - public Response> scriptExists(String sampleKey, String... sha1) { - return appendCommand(commandObjects.scriptExists(sampleKey, sha1)); - } - - @Override - public Response scriptLoad(String script, String sampleKey) { - return appendCommand(commandObjects.scriptLoad(script, sampleKey)); - } - - @Override - public Response scriptFlush(String sampleKey) { - return appendCommand(commandObjects.scriptFlush(sampleKey)); - } - - @Override - public Response scriptFlush(String sampleKey, FlushMode flushMode) { - return appendCommand(commandObjects.scriptFlush(sampleKey, flushMode)); - } - - @Override - public Response scriptKill(String sampleKey) { - return appendCommand(commandObjects.scriptKill(sampleKey)); - } - - @Override - public Response fcall(byte[] name, List keys, List args) { - return appendCommand(commandObjects.fcall(name, keys, args)); - } - - @Override - public Response fcall(String name, List keys, List args) { - return appendCommand(commandObjects.fcall(name, keys, args)); - } - - @Override - public Response fcallReadonly(byte[] name, List keys, List args) { - return appendCommand(commandObjects.fcallReadonly(name, keys, args)); - } - - @Override - public Response fcallReadonly(String name, List keys, List args) { - return appendCommand(commandObjects.fcallReadonly(name, keys, args)); - } - - @Override - public Response functionDelete(byte[] libraryName) { - return appendCommand(commandObjects.functionDelete(libraryName)); - } - - @Override - public Response functionDelete(String libraryName) { - return appendCommand(commandObjects.functionDelete(libraryName)); - } - - @Override - public Response functionDump() { - return appendCommand(commandObjects.functionDump()); - } - - @Override - public Response> functionList(String libraryNamePattern) { - return appendCommand(commandObjects.functionList(libraryNamePattern)); - } - - @Override - public Response> functionList() { - return appendCommand(commandObjects.functionList()); - } - - @Override - public Response> functionListWithCode(String libraryNamePattern) { - return appendCommand(commandObjects.functionListWithCode(libraryNamePattern)); - } - - @Override - public Response> functionListWithCode() { - return appendCommand(commandObjects.functionListWithCode()); - } - - @Override - public Response> functionListBinary() { - return appendCommand(commandObjects.functionListBinary()); - } - - @Override - public Response> functionList(final byte[] libraryNamePattern) { - return appendCommand(commandObjects.functionList(libraryNamePattern)); - } - - @Override - public Response> functionListWithCodeBinary() { - return appendCommand(commandObjects.functionListWithCodeBinary()); - } - - @Override - public Response> functionListWithCode(final byte[] libraryNamePattern) { - return appendCommand(commandObjects.functionListWithCode(libraryNamePattern)); - } - - @Override - public Response functionLoad(byte[] functionCode) { - return appendCommand(commandObjects.functionLoad(functionCode)); - } - - @Override - public Response functionLoad(String functionCode) { - return appendCommand(commandObjects.functionLoad(functionCode)); - } - - @Override - public Response functionLoadReplace(byte[] functionCode) { - return appendCommand(commandObjects.functionLoadReplace(functionCode)); - } - - @Override - public Response functionLoadReplace(String functionCode) { - return appendCommand(commandObjects.functionLoadReplace(functionCode)); - } - - @Override - public Response functionRestore(byte[] serializedValue) { - return appendCommand(commandObjects.functionRestore(serializedValue)); - } - - @Override - public Response functionRestore(byte[] serializedValue, FunctionRestorePolicy policy) { - return appendCommand(commandObjects.functionRestore(serializedValue, policy)); - } - - @Override - public Response functionFlush() { - return appendCommand(commandObjects.functionFlush()); - } - - @Override - public Response functionFlush(FlushMode mode) { - return appendCommand(commandObjects.functionFlush(mode)); - } - - @Override - public Response functionKill() { - return appendCommand(commandObjects.functionKill()); - } - - @Override - public Response functionStats() { - return appendCommand(commandObjects.functionStats()); - } - - @Override - public Response functionStatsBinary() { - return appendCommand(commandObjects.functionStatsBinary()); - } - - public Response publish(String channel, String message) { - return appendCommand(commandObjects.publish(channel, message)); - } - - @Override - public Response geoadd(byte[] key, double longitude, double latitude, byte[] member) { - return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); - } - - @Override - public Response geoadd(byte[] key, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, memberCoordinateMap)); - } - - @Override - public Response geoadd(byte[] key, GeoAddParams params, Map memberCoordinateMap) { - return appendCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); - } - - @Override - public Response geodist(byte[] key, byte[] member1, byte[] member2) { - return appendCommand(commandObjects.geodist(key, member1, member2)); - } - - @Override - public Response geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit) { - return appendCommand(commandObjects.geodist(key, member1, member2, unit)); - } - - @Override - public Response> geohash(byte[] key, byte[]... members) { - return appendCommand(commandObjects.geohash(key, members)); - } - - @Override - public Response> geopos(byte[] key, byte[]... members) { - return appendCommand(commandObjects.geopos(key, members)); - } - - @Override - public Response> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); - } - - @Override - public Response> georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); - } - - @Override - public Response> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); - } - - @Override - public Response> georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); - } - - @Override - public Response> georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { - return appendCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); - } - - @Override - public Response georadiusStore(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); - } - - @Override - public Response georadiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return appendCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); - } - - @Override - public Response> geosearch(byte[] key, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, radius, unit)); - } - - @Override - public Response> geosearch(byte[] key, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, radius, unit)); - } - - @Override - public Response> geosearch(byte[] key, byte[] member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, member, width, height, unit)); - } - - @Override - public Response> geosearch(byte[] key, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearch(key, coord, width, height, unit)); - } - - @Override - public Response> geosearch(byte[] key, GeoSearchParam params) { - return appendCommand(commandObjects.geosearch(key, params)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, byte[] member, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, radius, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double radius, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, byte[] member, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double width, double height, GeoUnit unit) { - return appendCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); - } - - @Override - public Response geosearchStore(byte[] dest, byte[] src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStore(dest, src, params)); - } - - @Override - public Response geosearchStoreStoreDist(byte[] dest, byte[] src, GeoSearchParam params) { - return appendCommand(commandObjects.geosearchStoreStoreDist(dest, src, params)); - } - - @Override - public Response hset(byte[] key, byte[] field, byte[] value) { - return appendCommand(commandObjects.hset(key, field, value)); - } - - @Override - public Response hset(byte[] key, Map hash) { - return appendCommand(commandObjects.hset(key, hash)); - } - - @Override - public Response hget(byte[] key, byte[] field) { - return appendCommand(commandObjects.hget(key, field)); - } - - @Override - public Response hsetnx(byte[] key, byte[] field, byte[] value) { - return appendCommand(commandObjects.hsetnx(key, field, value)); - } - - @Override - public Response hmset(byte[] key, Map hash) { - return appendCommand(commandObjects.hmset(key, hash)); - } - - @Override - public Response> hmget(byte[] key, byte[]... fields) { - return appendCommand(commandObjects.hmget(key, fields)); - } - - @Override - public Response hincrBy(byte[] key, byte[] field, long value) { - return appendCommand(commandObjects.hincrBy(key, field, value)); - } - - @Override - public Response hincrByFloat(byte[] key, byte[] field, double value) { - return appendCommand(commandObjects.hincrByFloat(key, field, value)); - } - - @Override - public Response hexists(byte[] key, byte[] field) { - return appendCommand(commandObjects.hexists(key, field)); - } - - @Override - public Response hdel(byte[] key, byte[]... field) { - return appendCommand(commandObjects.hdel(key, field)); - } - - @Override - public Response hlen(byte[] key) { - return appendCommand(commandObjects.hlen(key)); - } - - @Override - public Response> hkeys(byte[] key) { - return appendCommand(commandObjects.hkeys(key)); - } - - @Override - public Response> hvals(byte[] key) { - return appendCommand(commandObjects.hvals(key)); - } - - @Override - public Response> hgetAll(byte[] key) { - return appendCommand(commandObjects.hgetAll(key)); - } - - @Override - public Response hrandfield(byte[] key) { - return appendCommand(commandObjects.hrandfield(key)); - } - - @Override - public Response> hrandfield(byte[] key, long count) { - return appendCommand(commandObjects.hrandfield(key, count)); - } - - @Override - public Response>> hrandfieldWithValues(byte[] key, long count) { - return appendCommand(commandObjects.hrandfieldWithValues(key, count)); - } - - @Override - public Response>> hscan(byte[] key, byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.hscan(key, cursor, params)); - } - - @Override - public Response hstrlen(byte[] key, byte[] field) { - return appendCommand(commandObjects.hstrlen(key, field)); - } - - @Override - public Response pfadd(byte[] key, byte[]... elements) { - return appendCommand(commandObjects.pfadd(key, elements)); - } - - @Override - public Response pfmerge(byte[] destkey, byte[]... sourcekeys) { - return appendCommand(commandObjects.pfmerge(destkey, sourcekeys)); - } - - @Override - public Response pfcount(byte[] key) { - return appendCommand(commandObjects.pfcount(key)); - } - - @Override - public Response pfcount(byte[]... keys) { - return appendCommand(commandObjects.pfcount(keys)); - } - - @Override - public Response exists(byte[] key) { - return appendCommand(commandObjects.exists(key)); - } - - @Override - public Response exists(byte[]... keys) { - return appendCommand(commandObjects.exists(keys)); - } - - @Override - public Response persist(byte[] key) { - return appendCommand(commandObjects.persist(key)); - } - - @Override - public Response type(byte[] key) { - return appendCommand(commandObjects.type(key)); - } - - @Override - public Response dump(byte[] key) { - return appendCommand(commandObjects.dump(key)); - } - - @Override - public Response restore(byte[] key, long ttl, byte[] serializedValue) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue)); - } - - @Override - public Response restore(byte[] key, long ttl, byte[] serializedValue, RestoreParams params) { - return appendCommand(commandObjects.restore(key, ttl, serializedValue, params)); - } - - @Override - public Response expire(byte[] key, long seconds) { - return appendCommand(commandObjects.expire(key, seconds)); - } - - @Override - public Response expire(byte[] key, long seconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expire(key, seconds, expiryOption)); - } - - @Override - public Response pexpire(byte[] key, long milliseconds) { - return appendCommand(commandObjects.pexpire(key, milliseconds)); - } - - @Override - public Response pexpire(byte[] key, long milliseconds, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpire(key, milliseconds, expiryOption)); - } - - @Override - public Response expireTime(byte[] key) { - return appendCommand(commandObjects.expireTime(key)); - } - - @Override - public Response pexpireTime(byte[] key) { - return appendCommand(commandObjects.pexpireTime(key)); - } - - @Override - public Response expireAt(byte[] key, long unixTime) { - return appendCommand(commandObjects.expireAt(key, unixTime)); - } - - @Override - public Response expireAt(byte[] key, long unixTime, ExpiryOption expiryOption) { - return appendCommand(commandObjects.expireAt(key, unixTime, expiryOption)); - } - - @Override - public Response pexpireAt(byte[] key, long millisecondsTimestamp) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp)); - } - - @Override - public Response pexpireAt(byte[] key, long millisecondsTimestamp, ExpiryOption expiryOption) { - return appendCommand(commandObjects.pexpireAt(key, millisecondsTimestamp, expiryOption)); - } - - @Override - public Response ttl(byte[] key) { - return appendCommand(commandObjects.ttl(key)); - } - - @Override - public Response pttl(byte[] key) { - return appendCommand(commandObjects.pttl(key)); - } - - @Override - public Response touch(byte[] key) { - return appendCommand(commandObjects.touch(key)); - } - - @Override - public Response touch(byte[]... keys) { - return appendCommand(commandObjects.touch(keys)); - } - - @Override - public Response> sort(byte[] key) { - return appendCommand(commandObjects.sort(key)); - } - - @Override - public Response> sort(byte[] key, SortingParams sortingParams) { - return appendCommand(commandObjects.sort(key, sortingParams)); - } - - @Override - public Response> sortReadonly(byte[] key, SortingParams sortingParams) { - return appendCommand(commandObjects.sortReadonly(key, sortingParams)); - } - - @Override - public Response del(byte[] key) { - return appendCommand(commandObjects.del(key)); - } - - @Override - public Response del(byte[]... keys) { - return appendCommand(commandObjects.del(keys)); - } - - @Override - public Response unlink(byte[] key) { - return appendCommand(commandObjects.unlink(key)); - } - - @Override - public Response unlink(byte[]... keys) { - return appendCommand(commandObjects.unlink(keys)); - } - - @Override - public Response copy(byte[] srcKey, byte[] dstKey, boolean replace) { - return appendCommand(commandObjects.copy(srcKey, dstKey, replace)); - } - - @Override - public Response rename(byte[] oldkey, byte[] newkey) { - return appendCommand(commandObjects.rename(oldkey, newkey)); - } - - @Override - public Response renamenx(byte[] oldkey, byte[] newkey) { - return appendCommand(commandObjects.renamenx(oldkey, newkey)); - } - - @Override - public Response sort(byte[] key, SortingParams sortingParams, byte[] dstkey) { - return appendCommand(commandObjects.sort(key, sortingParams, dstkey)); - } - - @Override - public Response sort(byte[] key, byte[] dstkey) { - return appendCommand(commandObjects.sort(key, dstkey)); - } - - @Override - public Response memoryUsage(byte[] key) { - return appendCommand(commandObjects.memoryUsage(key)); - } - - @Override - public Response memoryUsage(byte[] key, int samples) { - return appendCommand(commandObjects.memoryUsage(key, samples)); - } - - @Override - public Response objectRefcount(byte[] key) { - return appendCommand(commandObjects.objectRefcount(key)); - } - - @Override - public Response objectEncoding(byte[] key) { - return appendCommand(commandObjects.objectEncoding(key)); - } - - @Override - public Response objectIdletime(byte[] key) { - return appendCommand(commandObjects.objectIdletime(key)); - } - - @Override - public Response objectFreq(byte[] key) { - return appendCommand(commandObjects.objectFreq(key)); - } - - @Override - public Response migrate(String host, int port, byte[] key, int timeout) { - return appendCommand(commandObjects.migrate(host, port, key, timeout)); - } - - @Override - public Response migrate(String host, int port, int timeout, MigrateParams params, byte[]... keys) { - return appendCommand(commandObjects.migrate(host, port, timeout, params, keys)); - } - - @Override - public Response> keys(byte[] pattern) { - return appendCommand(commandObjects.keys(pattern)); - } - - @Override - public Response> scan(byte[] cursor) { - return appendCommand(commandObjects.scan(cursor)); - } - - @Override - public Response> scan(byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.scan(cursor, params)); - } - - @Override - public Response> scan(byte[] cursor, ScanParams params, byte[] type) { - return appendCommand(commandObjects.scan(cursor, params, type)); - } - - @Override - public Response randomBinaryKey() { - return appendCommand(commandObjects.randomBinaryKey()); - } - - @Override - public Response rpush(byte[] key, byte[]... args) { - return appendCommand(commandObjects.rpush(key, args)); - } - - @Override - public Response lpush(byte[] key, byte[]... args) { - return appendCommand(commandObjects.lpush(key, args)); - } - - @Override - public Response llen(byte[] key) { - return appendCommand(commandObjects.llen(key)); - } - - @Override - public Response> lrange(byte[] key, long start, long stop) { - return appendCommand(commandObjects.lrange(key, start, stop)); - } - - @Override - public Response ltrim(byte[] key, long start, long stop) { - return appendCommand(commandObjects.ltrim(key, start, stop)); - } - - @Override - public Response lindex(byte[] key, long index) { - return appendCommand(commandObjects.lindex(key, index)); - } - - @Override - public Response lset(byte[] key, long index, byte[] value) { - return appendCommand(commandObjects.lset(key, index, value)); - } - - @Override - public Response lrem(byte[] key, long count, byte[] value) { - return appendCommand(commandObjects.lrem(key, count, value)); - } - - @Override - public Response lpop(byte[] key) { - return appendCommand(commandObjects.lpop(key)); - } - - @Override - public Response> lpop(byte[] key, int count) { - return appendCommand(commandObjects.lpop(key, count)); - } - - @Override - public Response lpos(byte[] key, byte[] element) { - return appendCommand(commandObjects.lpos(key, element)); - } - - @Override - public Response lpos(byte[] key, byte[] element, LPosParams params) { - return appendCommand(commandObjects.lpos(key, element, params)); - } - - @Override - public Response> lpos(byte[] key, byte[] element, LPosParams params, long count) { - return appendCommand(commandObjects.lpos(key, element, params, count)); - } - - @Override - public Response rpop(byte[] key) { - return appendCommand(commandObjects.rpop(key)); - } - - @Override - public Response> rpop(byte[] key, int count) { - return appendCommand(commandObjects.rpop(key, count)); - } - - @Override - public Response linsert(byte[] key, ListPosition where, byte[] pivot, byte[] value) { - return appendCommand(commandObjects.linsert(key, where, pivot, value)); - } - - @Override - public Response lpushx(byte[] key, byte[]... args) { - return appendCommand(commandObjects.lpushx(key, args)); - } - - @Override - public Response rpushx(byte[] key, byte[]... args) { - return appendCommand(commandObjects.rpushx(key, args)); - } - - @Override - public Response> blpop(int timeout, byte[]... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> blpop(double timeout, byte[]... keys) { - return appendCommand(commandObjects.blpop(timeout, keys)); - } - - @Override - public Response> brpop(int timeout, byte[]... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response> brpop(double timeout, byte[]... keys) { - return appendCommand(commandObjects.brpop(timeout, keys)); - } - - @Override - public Response rpoplpush(byte[] srckey, byte[] dstkey) { - return appendCommand(commandObjects.rpoplpush(srckey, dstkey)); - } - - @Override - public Response brpoplpush(byte[] source, byte[] destination, int timeout) { - return appendCommand(commandObjects.brpoplpush(source, destination, timeout)); - } - - @Override - public Response lmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to) { - return appendCommand(commandObjects.lmove(srcKey, dstKey, from, to)); - } - - @Override - public Response blmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to, double timeout) { - return appendCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); - } - - @Override - public Response>> lmpop(ListDirection direction, byte[]... keys) { - return appendCommand(commandObjects.lmpop(direction, keys)); - } - - @Override - public Response>> lmpop(ListDirection direction, int count, byte[]... keys) { - return appendCommand(commandObjects.lmpop(direction, count, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, byte[]... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, keys)); - } - - @Override - public Response>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { - return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); - } - - public Response publish(byte[] channel, byte[] message) { - return appendCommand(commandObjects.publish(channel, message)); - } - - @Override - public Response waitReplicas(byte[] sampleKey, int replicas, long timeout) { - return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); - } - - @Override - public Response> waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) { - return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); - } - - @Override - public Response eval(byte[] script, byte[] sampleKey) { - return appendCommand(commandObjects.eval(script, sampleKey)); - } - - @Override - public Response evalsha(byte[] sha1, byte[] sampleKey) { - return appendCommand(commandObjects.evalsha(sha1, sampleKey)); - } - - @Override - public Response> scriptExists(byte[] sampleKey, byte[]... sha1s) { - return appendCommand(commandObjects.scriptExists(sampleKey, sha1s)); - } - - @Override - public Response scriptLoad(byte[] script, byte[] sampleKey) { - return appendCommand(commandObjects.scriptLoad(script, sampleKey)); - } - - @Override - public Response scriptFlush(byte[] sampleKey) { - return appendCommand(commandObjects.scriptFlush(sampleKey)); - } - - @Override - public Response scriptFlush(byte[] sampleKey, FlushMode flushMode) { - return appendCommand(commandObjects.scriptFlush(sampleKey, flushMode)); - } - - @Override - public Response scriptKill(byte[] sampleKey) { - return appendCommand(commandObjects.scriptKill(sampleKey)); - } - - @Override - public Response eval(byte[] script) { - return appendCommand(commandObjects.eval(script)); - } - - @Override - public Response eval(byte[] script, int keyCount, byte[]... params) { - return appendCommand(commandObjects.eval(script, keyCount, params)); - } - - @Override - public Response eval(byte[] script, List keys, List args) { - return appendCommand(commandObjects.eval(script, keys, args)); - } - - @Override - public Response evalReadonly(byte[] script, List keys, List args) { - return appendCommand(commandObjects.evalReadonly(script, keys, args)); - } - - @Override - public Response evalsha(byte[] sha1) { - return appendCommand(commandObjects.evalsha(sha1)); - } - - @Override - public Response evalsha(byte[] sha1, int keyCount, byte[]... params) { - return appendCommand(commandObjects.evalsha(sha1, keyCount, params)); - } - - @Override - public Response evalsha(byte[] sha1, List keys, List args) { - return appendCommand(commandObjects.evalsha(sha1, keys, args)); - } - - @Override - public Response evalshaReadonly(byte[] sha1, List keys, List args) { - return appendCommand(commandObjects.evalshaReadonly(sha1, keys, args)); - } - - @Override - public Response sadd(byte[] key, byte[]... members) { - return appendCommand(commandObjects.sadd(key, members)); - } - - @Override - public Response> smembers(byte[] key) { - return appendCommand(commandObjects.smembers(key)); - } - - @Override - public Response srem(byte[] key, byte[]... members) { - return appendCommand(commandObjects.srem(key, members)); - } - - @Override - public Response spop(byte[] key) { - return appendCommand(commandObjects.spop(key)); - } - - @Override - public Response> spop(byte[] key, long count) { - return appendCommand(commandObjects.spop(key, count)); - } - - @Override - public Response scard(byte[] key) { - return appendCommand(commandObjects.scard(key)); - } - - @Override - public Response sismember(byte[] key, byte[] member) { - return appendCommand(commandObjects.sismember(key, member)); - } - - @Override - public Response> smismember(byte[] key, byte[]... members) { - return appendCommand(commandObjects.smismember(key, members)); - } - - @Override - public Response srandmember(byte[] key) { - return appendCommand(commandObjects.srandmember(key)); - } - - @Override - public Response> srandmember(byte[] key, int count) { - return appendCommand(commandObjects.srandmember(key, count)); - } - - @Override - public Response> sscan(byte[] key, byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.sscan(key, cursor, params)); - } - - @Override - public Response> sdiff(byte[]... keys) { - return appendCommand(commandObjects.sdiff(keys)); - } - - @Override - public Response sdiffstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.sdiffstore(dstkey, keys)); - } - - @Override - public Response> sinter(byte[]... keys) { - return appendCommand(commandObjects.sinter(keys)); - } - - @Override - public Response sinterstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.sinterstore(dstkey, keys)); - } - - @Override - public Response sintercard(byte[]... keys) { - return appendCommand(commandObjects.sintercard(keys)); - } - - @Override - public Response sintercard(int limit, byte[]... keys) { - return appendCommand(commandObjects.sintercard(limit, keys)); - } - - @Override - public Response> sunion(byte[]... keys) { - return appendCommand(commandObjects.sunion(keys)); - } - - @Override - public Response sunionstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.sunionstore(dstkey, keys)); - } - - @Override - public Response smove(byte[] srckey, byte[] dstkey, byte[] member) { - return appendCommand(commandObjects.smove(srckey, dstkey, member)); - } - - @Override - public Response zadd(byte[] key, double score, byte[] member) { - return appendCommand(commandObjects.zadd(key, score, member)); - } - - @Override - public Response zadd(byte[] key, double score, byte[] member, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, score, member, params)); - } - - @Override - public Response zadd(byte[] key, Map scoreMembers) { - return appendCommand(commandObjects.zadd(key, scoreMembers)); - } - - @Override - public Response zadd(byte[] key, Map scoreMembers, ZAddParams params) { - return appendCommand(commandObjects.zadd(key, scoreMembers, params)); - } - - @Override - public Response zaddIncr(byte[] key, double score, byte[] member, ZAddParams params) { - return appendCommand(commandObjects.zaddIncr(key, score, member, params)); - } - - @Override - public Response zrem(byte[] key, byte[]... members) { - return appendCommand(commandObjects.zrem(key, members)); - } - - @Override - public Response zincrby(byte[] key, double increment, byte[] member) { - return appendCommand(commandObjects.zincrby(key, increment, member)); - } - - @Override - public Response zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params) { - return appendCommand(commandObjects.zincrby(key, increment, member, params)); - } - - @Override - public Response zrank(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrank(key, member)); - } - - @Override - public Response zrevrank(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrevrank(key, member)); - } - - @Override - public Response> zrankWithScore(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrankWithScore(key, member)); - } - - @Override - public Response> zrevrankWithScore(byte[] key, byte[] member) { - return appendCommand(commandObjects.zrevrankWithScore(key, member)); - } - - @Override - public Response> zrange(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrange(key, start, stop)); - } - - @Override - public Response> zrevrange(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrevrange(key, start, stop)); - } - - @Override - public Response> zrangeWithScores(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrangeWithScores(key, start, stop)); - } - - @Override - public Response> zrevrangeWithScores(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zrevrangeWithScores(key, start, stop)); - } - - @Override - public Response> zrange(byte[] key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrange(key, zRangeParams)); - } - - @Override - public Response> zrangeWithScores(byte[] key, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangeWithScores(key, zRangeParams)); - } - - @Override - public Response zrangestore(byte[] dest, byte[] src, ZRangeParams zRangeParams) { - return appendCommand(commandObjects.zrangestore(dest, src, zRangeParams)); - } - - @Override - public Response zrandmember(byte[] key) { - return appendCommand(commandObjects.zrandmember(key)); - } - - @Override - public Response> zrandmember(byte[] key, long count) { - return appendCommand(commandObjects.zrandmember(key, count)); - } - - @Override - public Response> zrandmemberWithScores(byte[] key, long count) { - return appendCommand(commandObjects.zrandmemberWithScores(key, count)); - } - - @Override - public Response zcard(byte[] key) { - return appendCommand(commandObjects.zcard(key)); - } - - @Override - public Response zscore(byte[] key, byte[] member) { - return appendCommand(commandObjects.zscore(key, member)); - } - - @Override - public Response> zmscore(byte[] key, byte[]... members) { - return appendCommand(commandObjects.zmscore(key, members)); - } - - @Override - public Response zpopmax(byte[] key) { - return appendCommand(commandObjects.zpopmax(key)); - } - - @Override - public Response> zpopmax(byte[] key, int count) { - return appendCommand(commandObjects.zpopmax(key, count)); - } - - @Override - public Response zpopmin(byte[] key) { - return appendCommand(commandObjects.zpopmin(key)); - } - - @Override - public Response> zpopmin(byte[] key, int count) { - return appendCommand(commandObjects.zpopmin(key, count)); - } - - @Override - public Response zcount(byte[] key, double min, double max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response zcount(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zcount(key, min, max)); - } - - @Override - public Response> zrangeByScore(byte[] key, double min, double max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrangeByScore(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zrangeByScore(key, min, max)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - } - - @Override - public Response> zrangeByScore(byte[] key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, byte[] max, byte[] min) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min)); - } - - @Override - public Response> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScore(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, double min, double max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, double max, double min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScore(key, max, min, offset, count)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min)); - } - - @Override - public Response> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count) { - return appendCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); - } - - @Override - public Response zremrangeByRank(byte[] key, long start, long stop) { - return appendCommand(commandObjects.zremrangeByRank(key, start, stop)); - } - - @Override - public Response zremrangeByScore(byte[] key, double min, double max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zremrangeByScore(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zremrangeByScore(key, min, max)); - } - - @Override - public Response zlexcount(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zlexcount(key, min, max)); - } - - @Override - public Response> zrangeByLex(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zrangeByLex(key, min, max)); - } - - @Override - public Response> zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count) { - return appendCommand(commandObjects.zrangeByLex(key, min, max, offset, count)); - } - - @Override - public Response> zrevrangeByLex(byte[] key, byte[] max, byte[] min) { - return appendCommand(commandObjects.zrevrangeByLex(key, min, max)); - } - - @Override - public Response> zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count) { - return appendCommand(commandObjects.zrevrangeByLex(key, min, max, offset, count)); - } - - @Override - public Response zremrangeByLex(byte[] key, byte[] min, byte[] max) { - return appendCommand(commandObjects.zremrangeByLex(key, min, max)); - } - - @Override - public Response> zscan(byte[] key, byte[] cursor, ScanParams params) { - return appendCommand(commandObjects.zscan(key, cursor, params)); - } - - @Override - public Response> bzpopmax(double timeout, byte[]... keys) { - return appendCommand(commandObjects.bzpopmax(timeout, keys)); - } - - @Override - public Response> bzpopmin(double timeout, byte[]... keys) { - return appendCommand(commandObjects.bzpopmin(timeout, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, byte[]... keys) { - return appendCommand(commandObjects.zmpop(option, keys)); - } - - @Override - public Response>> zmpop(SortedSetOption option, int count, byte[]... keys) { - return appendCommand(commandObjects.zmpop(option, count, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, keys)); - } - - @Override - public Response>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { - return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); - } - - @Override - public Response> zdiff(byte[]... keys) { - return appendCommand(commandObjects.zdiff(keys)); - } - - @Override - public Response> zdiffWithScores(byte[]... keys) { - return appendCommand(commandObjects.zdiffWithScores(keys)); - } - - @Override - @Deprecated - public Response zdiffStore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.zdiffStore(dstkey, keys)); - } - - @Override - public Response zdiffstore(byte[] dstkey, byte[]... keys) { - return appendCommand(commandObjects.zdiffstore(dstkey, keys)); - } - - @Override - public Response> zinter(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zinter(params, keys)); - } - - @Override - public Response> zinterWithScores(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zinterWithScores(params, keys)); - } - - @Override - public Response zinterstore(byte[] dstkey, byte[]... sets) { - return appendCommand(commandObjects.zinterstore(dstkey, sets)); - } - - @Override - public Response zinterstore(byte[] dstkey, ZParams params, byte[]... sets) { - return appendCommand(commandObjects.zinterstore(dstkey, params, sets)); - } - - @Override - public Response zintercard(byte[]... keys) { - return appendCommand(commandObjects.zintercard(keys)); - } - - @Override - public Response zintercard(long limit, byte[]... keys) { - return appendCommand(commandObjects.zintercard(limit, keys)); - } - - @Override - public Response> zunion(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zunion(params, keys)); - } - - @Override - public Response> zunionWithScores(ZParams params, byte[]... keys) { - return appendCommand(commandObjects.zunionWithScores(params, keys)); - } - - @Override - public Response zunionstore(byte[] dstkey, byte[]... sets) { - return appendCommand(commandObjects.zunionstore(dstkey, sets)); - } - - @Override - public Response zunionstore(byte[] dstkey, ZParams params, byte[]... sets) { - return appendCommand(commandObjects.zunionstore(dstkey, params, sets)); - } - - @Override - public Response xadd(byte[] key, XAddParams params, Map hash) { - return appendCommand(commandObjects.xadd(key, params, hash)); - } - - @Override - public Response xlen(byte[] key) { - return appendCommand(commandObjects.xlen(key)); - } - - @Override - public Response> xrange(byte[] key, byte[] start, byte[] end) { - return appendCommand(commandObjects.xrange(key, start, end)); - } - - @Override - public Response> xrange(byte[] key, byte[] start, byte[] end, int count) { - return appendCommand(commandObjects.xrange(key, start, end, count)); - } - - @Override - public Response> xrevrange(byte[] key, byte[] end, byte[] start) { - return appendCommand(commandObjects.xrevrange(key, end, start)); - } - - @Override - public Response> xrevrange(byte[] key, byte[] end, byte[] start, int count) { - return appendCommand(commandObjects.xrevrange(key, end, start, count)); - } - - @Override - public Response xack(byte[] key, byte[] group, byte[]... ids) { - return appendCommand(commandObjects.xack(key, group, ids)); - } - - @Override - public Response xgroupCreate(byte[] key, byte[] groupName, byte[] id, boolean makeStream) { - return appendCommand(commandObjects.xgroupCreate(key, groupName, id, makeStream)); - } - - @Override - public Response xgroupSetID(byte[] key, byte[] groupName, byte[] id) { - return appendCommand(commandObjects.xgroupSetID(key, groupName, id)); - } - - @Override - public Response xgroupDestroy(byte[] key, byte[] groupName) { - return appendCommand(commandObjects.xgroupDestroy(key, groupName)); - } - - @Override - public Response xgroupCreateConsumer(byte[] key, byte[] groupName, byte[] consumerName) { - return appendCommand(commandObjects.xgroupCreateConsumer(key, groupName, consumerName)); - } - - @Override - public Response xgroupDelConsumer(byte[] key, byte[] groupName, byte[] consumerName) { - return appendCommand(commandObjects.xgroupDelConsumer(key, groupName, consumerName)); - } - - @Override - public Response xdel(byte[] key, byte[]... ids) { - return appendCommand(commandObjects.xdel(key, ids)); - } - - @Override - public Response xtrim(byte[] key, long maxLen, boolean approximateLength) { - return appendCommand(commandObjects.xtrim(key, maxLen, approximateLength)); - } - - @Override - public Response xtrim(byte[] key, XTrimParams params) { - return appendCommand(commandObjects.xtrim(key, params)); - } - - @Override - public Response xpending(byte[] key, byte[] groupName) { - return appendCommand(commandObjects.xpending(key, groupName)); - } - - @Override - public Response> xpending(byte[] key, byte[] groupName, XPendingParams params) { - return appendCommand(commandObjects.xpending(key, groupName, params)); - } - - @Override - public Response> xclaim(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { - return appendCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response> xclaimJustId(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { - return appendCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); - } - - @Override - public Response> xautoclaim(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaim(key, groupName, consumerName, minIdleTime, start, params)); - } - - @Override - public Response> xautoclaimJustId(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { - return appendCommand(commandObjects.xautoclaimJustId(key, groupName, consumerName, minIdleTime, start, params)); - } - - @Override - public Response xinfoStream(byte[] key) { - return appendCommand(commandObjects.xinfoStream(key)); - } - - @Override - public Response xinfoStreamFull(byte[] key) { - return appendCommand(commandObjects.xinfoStreamFull(key)); - } - - @Override - public Response xinfoStreamFull(byte[] key, int count) { - return appendCommand(commandObjects.xinfoStreamFull(key, count)); - } - - @Override - public Response> xinfoGroups(byte[] key) { - return appendCommand(commandObjects.xinfoGroups(key)); - } - - @Override - public Response> xinfoConsumers(byte[] key, byte[] group) { - return appendCommand(commandObjects.xinfoConsumers(key, group)); - } - - @Override - public Response> xread(XReadParams xReadParams, Map.Entry... streams) { - return appendCommand(commandObjects.xread(xReadParams, streams)); - } - - @Override - public Response> xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Map.Entry... streams) { - return appendCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); - } - - @Override - public Response set(byte[] key, byte[] value) { - return appendCommand(commandObjects.set(key, value)); - } - - @Override - public Response set(byte[] key, byte[] value, SetParams params) { - return appendCommand(commandObjects.set(key, value, params)); - } - - @Override - public Response get(byte[] key) { - return appendCommand(commandObjects.get(key)); - } - - @Override - public Response setGet(byte[] key, byte[] value, SetParams params) { - return appendCommand(commandObjects.setGet(key, value, params)); - } - - @Override - public Response getDel(byte[] key) { - return appendCommand(commandObjects.getDel(key)); - } - - @Override - public Response getEx(byte[] key, GetExParams params) { - return appendCommand(commandObjects.getEx(key, params)); - } - - @Override - public Response setbit(byte[] key, long offset, boolean value) { - return appendCommand(commandObjects.setbit(key, offset, value)); - } - - @Override - public Response getbit(byte[] key, long offset) { - return appendCommand(commandObjects.getbit(key, offset)); - } - - @Override - public Response setrange(byte[] key, long offset, byte[] value) { - return appendCommand(commandObjects.setrange(key, offset, value)); - } - - @Override - public Response getrange(byte[] key, long startOffset, long endOffset) { - return appendCommand(commandObjects.getrange(key, startOffset, endOffset)); - } - - @Override - public Response getSet(byte[] key, byte[] value) { - return appendCommand(commandObjects.getSet(key, value)); - } - - @Override - public Response setnx(byte[] key, byte[] value) { - return appendCommand(commandObjects.setnx(key, value)); - } - - @Override - public Response setex(byte[] key, long seconds, byte[] value) { - return appendCommand(commandObjects.setex(key, seconds, value)); - } - - @Override - public Response psetex(byte[] key, long milliseconds, byte[] value) { - return appendCommand(commandObjects.psetex(key, milliseconds, value)); - } - - @Override - public Response> mget(byte[]... keys) { - return appendCommand(commandObjects.mget(keys)); - } - - @Override - public Response mset(byte[]... keysvalues) { - return appendCommand(commandObjects.mset(keysvalues)); - } - - @Override - public Response msetnx(byte[]... keysvalues) { - return appendCommand(commandObjects.msetnx(keysvalues)); - } - - @Override - public Response incr(byte[] key) { - return appendCommand(commandObjects.incr(key)); - } - - @Override - public Response incrBy(byte[] key, long increment) { - return appendCommand(commandObjects.incrBy(key, increment)); - } - - @Override - public Response incrByFloat(byte[] key, double increment) { - return appendCommand(commandObjects.incrByFloat(key, increment)); - } - - @Override - public Response decr(byte[] key) { - return appendCommand(commandObjects.decr(key)); - } - - @Override - public Response decrBy(byte[] key, long decrement) { - return appendCommand(commandObjects.decrBy(key, decrement)); - } - - @Override - public Response append(byte[] key, byte[] value) { - return appendCommand(commandObjects.append(key, value)); - } - - @Override - public Response substr(byte[] key, int start, int end) { - return appendCommand(commandObjects.substr(key, start, end)); - } - - @Override - public Response strlen(byte[] key) { - return appendCommand(commandObjects.strlen(key)); - } - - @Override - public Response bitcount(byte[] key) { - return appendCommand(commandObjects.bitcount(key)); - } - - @Override - public Response bitcount(byte[] key, long start, long end) { - return appendCommand(commandObjects.bitcount(key, start, end)); - } - - @Override - public Response bitcount(byte[] key, long start, long end, BitCountOption option) { - return appendCommand(commandObjects.bitcount(key, start, end, option)); - } - - @Override - public Response bitpos(byte[] key, boolean value) { - return appendCommand(commandObjects.bitpos(key, value)); - } - - @Override - public Response bitpos(byte[] key, boolean value, BitPosParams params) { - return appendCommand(commandObjects.bitpos(key, value, params)); - } - - @Override - public Response> bitfield(byte[] key, byte[]... arguments) { - return appendCommand(commandObjects.bitfield(key, arguments)); - } - - @Override - public Response> bitfieldReadonly(byte[] key, byte[]... arguments) { - return appendCommand(commandObjects.bitfieldReadonly(key, arguments)); - } - - @Override - public Response bitop(BitOP op, byte[] destKey, byte[]... srcKeys) { - return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); - } - - // RediSearch commands - @Override - public Response ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { - return appendCommand(commandObjects.ftCreate(indexName, indexOptions, schema)); - } - - @Override - public Response ftCreate(String indexName, FTCreateParams createParams, Iterable schemaFields) { - return appendCommand(commandObjects.ftCreate(indexName, createParams, schemaFields)); - } - - @Override - public Response ftAlter(String indexName, Schema schema) { - return appendCommand(commandObjects.ftAlter(indexName, schema)); - } - - @Override - public Response ftAlter(String indexName, Iterable schemaFields) { - return appendCommand(commandObjects.ftAlter(indexName, schemaFields)); - } - - @Override - public Response ftSearch(String indexName, String query) { - return appendCommand(commandObjects.ftSearch(indexName, query)); - } - - @Override - public Response ftSearch(String indexName, String query, FTSearchParams searchParams) { - return appendCommand(commandObjects.ftSearch(indexName, query, searchParams)); - } - - @Override - public Response ftSearch(String indexName, Query query) { - return appendCommand(commandObjects.ftSearch(indexName, query)); - } - - @Override - public Response ftSearch(byte[] indexName, Query query) { - return appendCommand(commandObjects.ftSearch(indexName, query)); - } - - @Override - public Response ftExplain(String indexName, Query query) { - return appendCommand(commandObjects.ftExplain(indexName, query)); - } - - @Override - public Response> ftExplainCLI(String indexName, Query query) { - return appendCommand(commandObjects.ftExplainCLI(indexName, query)); - } - - @Override - public Response ftAggregate(String indexName, AggregationBuilder aggr) { - return appendCommand(commandObjects.ftAggregate(indexName, aggr)); - } - - @Override - public Response ftSynUpdate(String indexName, String synonymGroupId, String... terms) { - return appendCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms)); - } - - @Override - public Response>> ftSynDump(String indexName) { - return appendCommand(commandObjects.ftSynDump(indexName)); - } - - @Override - public Response ftDictAdd(String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictAdd(dictionary, terms)); - } - - @Override - public Response ftDictDel(String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictDel(dictionary, terms)); - } - - @Override - public Response> ftDictDump(String dictionary) { - return appendCommand(commandObjects.ftDictDump(dictionary)); - } - - @Override - public Response ftDictAddBySampleKey(String indexName, String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictAddBySampleKey(indexName, dictionary, terms)); - } - - @Override - public Response ftDictDelBySampleKey(String indexName, String dictionary, String... terms) { - return appendCommand(commandObjects.ftDictDelBySampleKey(indexName, dictionary, terms)); - } - - @Override - public Response> ftDictDumpBySampleKey(String indexName, String dictionary) { - return appendCommand(commandObjects.ftDictDumpBySampleKey(indexName, dictionary)); - } - - @Override - public Response>> ftSpellCheck(String index, String query) { - return appendCommand(commandObjects.ftSpellCheck(index, query)); - } - - @Override - public Response>> ftSpellCheck(String index, String query, FTSpellCheckParams spellCheckParams) { - return appendCommand(commandObjects.ftSpellCheck(index, query, spellCheckParams)); - } - - @Override - public Response> ftInfo(String indexName) { - return appendCommand(commandObjects.ftInfo(indexName)); - } - - @Override - public Response> ftTagVals(String indexName, String fieldName) { - return appendCommand(commandObjects.ftTagVals(indexName, fieldName)); - } - - @Override - public Response> ftConfigGet(String option) { - return appendCommand(commandObjects.ftConfigGet(option)); - } - - @Override - public Response> ftConfigGet(String indexName, String option) { - return appendCommand(commandObjects.ftConfigGet(indexName, option)); - } - - @Override - public Response ftConfigSet(String option, String value) { - return appendCommand(commandObjects.ftConfigSet(option, value)); - } - - @Override - public Response ftConfigSet(String indexName, String option, String value) { - return appendCommand(commandObjects.ftConfigSet(indexName, option, value)); - } - - @Override - public Response ftSugAdd(String key, String string, double score) { - return appendCommand(commandObjects.ftSugAdd(key, string, score)); - } - - @Override - public Response ftSugAddIncr(String key, String string, double score) { - return appendCommand(commandObjects.ftSugAddIncr(key, string, score)); - } - - @Override - public Response> ftSugGet(String key, String prefix) { - return appendCommand(commandObjects.ftSugGet(key, prefix)); - } - - @Override - public Response> ftSugGet(String key, String prefix, boolean fuzzy, int max) { - return appendCommand(commandObjects.ftSugGet(key, prefix, fuzzy, max)); - } - - @Override - public Response> ftSugGetWithScores(String key, String prefix) { - return appendCommand(commandObjects.ftSugGetWithScores(key, prefix)); - } - - @Override - public Response> ftSugGetWithScores(String key, String prefix, boolean fuzzy, int max) { - return appendCommand(commandObjects.ftSugGetWithScores(key, prefix, fuzzy, max)); - } - - @Override - public Response ftSugDel(String key, String string) { - return appendCommand(commandObjects.ftSugDel(key, string)); - } - - @Override - public Response ftSugLen(String key) { - return appendCommand(commandObjects.ftSugLen(key)); - } - // RediSearch commands - - // RedisJSON commands - @Override - public Response lcs(byte[] keyA, byte[] keyB, LCSParams params) { - return appendCommand(commandObjects.lcs(keyA, keyB, params)); - } - - - @Override - public Response jsonSet(String key, Path2 path, Object object) { - return appendCommand(commandObjects.jsonSet(key, path, object)); - } - - @Override - public Response jsonSetWithEscape(String key, Path2 path, Object object) { - return appendCommand(commandObjects.jsonSetWithEscape(key, path, object)); - } - - @Override - public Response jsonSet(String key, Path path, Object object) { - return appendCommand(commandObjects.jsonSet(key, path, object)); - } - - @Override - public Response jsonSet(String key, Path2 path, Object object, JsonSetParams params) { - return appendCommand(commandObjects.jsonSet(key, path, object, params)); - } - - @Override - public Response jsonSetWithEscape(String key, Path2 path, Object object, JsonSetParams params) { - return appendCommand(commandObjects.jsonSetWithEscape(key, path, object, params)); - } - - @Override - public Response jsonSet(String key, Path path, Object object, JsonSetParams params) { - return appendCommand(commandObjects.jsonSet(key, path, object, params)); - } - - @Override - public Response jsonMerge(String key, Path2 path, Object object) { - return appendCommand(commandObjects.jsonMerge(key, path, object)); - } - - @Override - public Response jsonMerge(String key, Path path, Object object) { - return appendCommand(commandObjects.jsonMerge(key, path, object)); - } - - @Override - public Response jsonGet(String key) { - return appendCommand(commandObjects.jsonGet(key)); - } - - @Override - public Response jsonGet(String key, Class clazz) { - return appendCommand(commandObjects.jsonGet(key, clazz)); - } - - @Override - public Response jsonGet(String key, Path2... paths) { - return appendCommand(commandObjects.jsonGet(key, paths)); - } - - @Override - public Response jsonGet(String key, Path... paths) { - return appendCommand(commandObjects.jsonGet(key, paths)); - } - - @Override - public Response jsonGet(String key, Class clazz, Path... paths) { - return appendCommand(commandObjects.jsonGet(key, clazz, paths)); - } - - @Override - public Response> jsonMGet(Path2 path, String... keys) { - return appendCommand(commandObjects.jsonMGet(path, keys)); - } - - @Override - public Response> jsonMGet(Path path, Class clazz, String... keys) { - return appendCommand(commandObjects.jsonMGet(path, clazz, keys)); - } - - @Override - public Response jsonDel(String key) { - return appendCommand(commandObjects.jsonDel(key)); - } - - @Override - public Response jsonDel(String key, Path2 path) { - return appendCommand(commandObjects.jsonDel(key, path)); - } - - @Override - public Response jsonDel(String key, Path path) { - return appendCommand(commandObjects.jsonDel(key, path)); - } - - @Override - public Response jsonClear(String key) { - return appendCommand(commandObjects.jsonClear(key)); - } - - @Override - public Response jsonClear(String key, Path2 path) { - return appendCommand(commandObjects.jsonClear(key, path)); - } - - @Override - public Response jsonClear(String key, Path path) { - return appendCommand(commandObjects.jsonClear(key, path)); - } - - @Override - public Response> jsonToggle(String key, Path2 path) { - return appendCommand(commandObjects.jsonToggle(key, path)); - } - - @Override - public Response jsonToggle(String key, Path path) { - return appendCommand(commandObjects.jsonToggle(key, path)); - } - - @Override - public Response> jsonType(String key) { - return appendCommand(commandObjects.jsonType(key)); - } - - @Override - public Response>> jsonType(String key, Path2 path) { - return appendCommand(commandObjects.jsonType(key, path)); - } - - @Override - public Response> jsonType(String key, Path path) { - return appendCommand(commandObjects.jsonType(key, path)); - } - - @Override - public Response jsonStrAppend(String key, Object string) { - return appendCommand(commandObjects.jsonStrAppend(key, string)); - } - - @Override - public Response> jsonStrAppend(String key, Path2 path, Object string) { - return appendCommand(commandObjects.jsonStrAppend(key, path, string)); - } - - @Override - public Response jsonStrAppend(String key, Path path, Object string) { - return appendCommand(commandObjects.jsonStrAppend(key, path, string)); - } - - @Override - public Response jsonStrLen(String key) { - return appendCommand(commandObjects.jsonStrLen(key)); - } - - @Override - public Response> jsonStrLen(String key, Path2 path) { - return appendCommand(commandObjects.jsonStrLen(key, path)); - } - - @Override - public Response jsonStrLen(String key, Path path) { - return appendCommand(commandObjects.jsonStrLen(key, path)); - } - - @Override - public Response jsonNumIncrBy(String key, Path2 path, double value) { - return appendCommand(commandObjects.jsonNumIncrBy(key, path, value)); - } - - @Override - public Response jsonNumIncrBy(String key, Path path, double value) { - return appendCommand(commandObjects.jsonNumIncrBy(key, path, value)); - } - - @Override - public Response> jsonArrAppend(String key, Path2 path, Object... objects) { - return appendCommand(commandObjects.jsonArrAppend(key, path, objects)); - } - - @Override - public Response> jsonArrAppendWithEscape(String key, Path2 path, Object... objects) { - return appendCommand(commandObjects.jsonArrAppendWithEscape(key, path, objects)); - } - - @Override - public Response jsonArrAppend(String key, Path path, Object... objects) { - return appendCommand(commandObjects.jsonArrAppend(key, path, objects)); - } - - @Override - public Response> jsonArrIndex(String key, Path2 path, Object scalar) { - return appendCommand(commandObjects.jsonArrIndex(key, path, scalar)); - } - - @Override - public Response> jsonArrIndexWithEscape(String key, Path2 path, Object scalar) { - return appendCommand(commandObjects.jsonArrIndexWithEscape(key, path, scalar)); - } - - @Override - public Response jsonArrIndex(String key, Path path, Object scalar) { - return appendCommand(commandObjects.jsonArrIndex(key, path, scalar)); - } - - @Override - public Response> jsonArrInsert(String key, Path2 path, int index, Object... objects) { - return appendCommand(commandObjects.jsonArrInsert(key, path, index, objects)); - } - - @Override - public Response> jsonArrInsertWithEscape(String key, Path2 path, int index, Object... objects) { - return appendCommand(commandObjects.jsonArrInsertWithEscape(key, path, index, objects)); - } - - @Override - public Response jsonArrInsert(String key, Path path, int index, Object... pojos) { - return appendCommand(commandObjects.jsonArrInsert(key, path, index, pojos)); - } - - @Override - public Response jsonArrPop(String key) { - return appendCommand(commandObjects.jsonArrPop(key)); - } - - @Override - public Response jsonArrLen(String key, Path path) { - return appendCommand(commandObjects.jsonArrLen(key, path)); - } - - @Override - public Response> jsonArrTrim(String key, Path2 path, int start, int stop) { - return appendCommand(commandObjects.jsonArrTrim(key, path, start, stop)); - } - - @Override - public Response jsonArrTrim(String key, Path path, int start, int stop) { - return appendCommand(commandObjects.jsonArrTrim(key, path, start, stop)); - } - - @Override - public Response jsonArrPop(String key, Class clazz, Path path) { - return appendCommand(commandObjects.jsonArrPop(key, clazz, path)); - } - - @Override - public Response> jsonArrPop(String key, Path2 path, int index) { - return appendCommand(commandObjects.jsonArrPop(key, path, index)); - } - - @Override - public Response jsonArrPop(String key, Path path, int index) { - return appendCommand(commandObjects.jsonArrPop(key, path, index)); - } - - @Override - public Response jsonArrPop(String key, Class clazz, Path path, int index) { - return appendCommand(commandObjects.jsonArrPop(key, clazz, path, index)); - } - - @Override - public Response jsonArrLen(String key) { - return appendCommand(commandObjects.jsonArrLen(key)); - } - - @Override - public Response> jsonArrLen(String key, Path2 path) { - return appendCommand(commandObjects.jsonArrLen(key, path)); - } - - @Override - public Response jsonArrPop(String key, Class clazz) { - return appendCommand(commandObjects.jsonArrPop(key, clazz)); - } - - @Override - public Response> jsonArrPop(String key, Path2 path) { - return appendCommand(commandObjects.jsonArrPop(key, path)); - } - - @Override - public Response jsonArrPop(String key, Path path) { - return appendCommand(commandObjects.jsonArrPop(key, path)); - } - // RedisJSON commands - - // RedisTimeSeries commands - @Override - public Response tsCreate(String key) { - return appendCommand(commandObjects.tsCreate(key)); - } - - @Override - public Response tsCreate(String key, TSCreateParams createParams) { - return appendCommand(commandObjects.tsCreate(key, createParams)); - } - - @Override - public Response tsDel(String key, long fromTimestamp, long toTimestamp) { - return appendCommand(commandObjects.tsDel(key, fromTimestamp, toTimestamp)); - } - - @Override - public Response tsAlter(String key, TSAlterParams alterParams) { - return appendCommand(commandObjects.tsAlter(key, alterParams)); - } - - @Override - public Response tsAdd(String key, double value) { - return appendCommand(commandObjects.tsAdd(key, value)); - } - - @Override - public Response tsAdd(String key, long timestamp, double value) { - return appendCommand(commandObjects.tsAdd(key, timestamp, value)); - } - - @Override - public Response tsAdd(String key, long timestamp, double value, TSCreateParams createParams) { - return appendCommand(commandObjects.tsAdd(key, timestamp, value, createParams)); - } - - @Override - public Response> tsMAdd(Map.Entry... entries) { - return appendCommand(commandObjects.tsMAdd(entries)); - } - - @Override - public Response tsIncrBy(String key, double value) { - return appendCommand(commandObjects.tsIncrBy(key, value)); - } - - @Override - public Response tsIncrBy(String key, double value, long timestamp) { - return appendCommand(commandObjects.tsIncrBy(key, value, timestamp)); - } - - @Override - public Response tsDecrBy(String key, double value) { - return appendCommand(commandObjects.tsDecrBy(key, value)); - } - - @Override - public Response tsDecrBy(String key, double value, long timestamp) { - return appendCommand(commandObjects.tsDecrBy(key, value, timestamp)); - } - - @Override - public Response> tsRange(String key, long fromTimestamp, long toTimestamp) { - return appendCommand(commandObjects.tsRange(key, fromTimestamp, toTimestamp)); - } - - @Override - public Response> tsRange(String key, TSRangeParams rangeParams) { - return appendCommand(commandObjects.tsRange(key, rangeParams)); - } - - @Override - public Response> tsRevRange(String key, long fromTimestamp, long toTimestamp) { - return appendCommand(commandObjects.tsRevRange(key, fromTimestamp, toTimestamp)); - } - - @Override - public Response> tsRevRange(String key, TSRangeParams rangeParams) { - return appendCommand(commandObjects.tsRevRange(key, rangeParams)); - } - - @Override - public Response> tsMRange(long fromTimestamp, long toTimestamp, String... filters) { - return appendCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); - } - - @Override - public Response> tsMRange(TSMRangeParams multiRangeParams) { - return appendCommand(commandObjects.tsMRange(multiRangeParams)); - } - - @Override - public Response> tsMRevRange(long fromTimestamp, long toTimestamp, String... filters) { - return appendCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); - } - - @Override - public Response> tsMRevRange(TSMRangeParams multiRangeParams) { - return appendCommand(commandObjects.tsMRevRange(multiRangeParams)); - } - - @Override - public Response tsGet(String key) { - return appendCommand(commandObjects.tsGet(key)); - } - - @Override - public Response tsGet(String key, TSGetParams getParams) { - return appendCommand(commandObjects.tsGet(key, getParams)); - } - - @Override - public Response> tsMGet(TSMGetParams multiGetParams, String... filters) { - return appendCommand(commandObjects.tsMGet(multiGetParams, filters)); - } - - @Override - public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long timeBucket) { - return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); - } - - @Override - public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long bucketDuration, long alignTimestamp) { - return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, bucketDuration, alignTimestamp)); - } - - @Override - public Response tsDeleteRule(String sourceKey, String destKey) { - return appendCommand(commandObjects.tsDeleteRule(sourceKey, destKey)); - } - - @Override - public Response> tsQueryIndex(String... filters) { - return appendCommand(commandObjects.tsQueryIndex(filters)); - } - // RedisTimeSeries commands - - // RedisBloom commands - @Override - public Response bfReserve(String key, double errorRate, long capacity) { - return appendCommand(commandObjects.bfReserve(key, errorRate, capacity)); - } - - @Override - public Response bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams) { - return appendCommand(commandObjects.bfReserve(key, errorRate, capacity, reserveParams)); - } - - @Override - public Response bfAdd(String key, String item) { - return appendCommand(commandObjects.bfAdd(key, item)); - } - - @Override - public Response> bfMAdd(String key, String... items) { - return appendCommand(commandObjects.bfMAdd(key, items)); - } - - @Override - public Response> bfInsert(String key, String... items) { - return appendCommand(commandObjects.bfInsert(key, items)); - } - - @Override - public Response> bfInsert(String key, BFInsertParams insertParams, String... items) { - return appendCommand(commandObjects.bfInsert(key, insertParams, items)); - } - - @Override - public Response bfExists(String key, String item) { - return appendCommand(commandObjects.bfExists(key, item)); - } - - @Override - public Response> bfMExists(String key, String... items) { - return appendCommand(commandObjects.bfMExists(key, items)); - } - - @Override - public Response> bfScanDump(String key, long iterator) { - return appendCommand(commandObjects.bfScanDump(key, iterator)); - } - - @Override - public Response bfLoadChunk(String key, long iterator, byte[] data) { - return appendCommand(commandObjects.bfLoadChunk(key, iterator, data)); - } - - @Override - public Response bfCard(String key) { - return appendCommand(commandObjects.bfCard(key)); - } - - @Override - public Response> bfInfo(String key) { - return appendCommand(commandObjects.bfInfo(key)); - } - - @Override - public Response cfReserve(String key, long capacity) { - return appendCommand(commandObjects.cfReserve(key, capacity)); - } - - @Override - public Response cfReserve(String key, long capacity, CFReserveParams reserveParams) { - return appendCommand(commandObjects.cfReserve(key, capacity, reserveParams)); - } - - @Override - public Response cfAdd(String key, String item) { - return appendCommand(commandObjects.cfAdd(key, item)); - } - - @Override - public Response cfAddNx(String key, String item) { - return appendCommand(commandObjects.cfAddNx(key, item)); - } - - @Override - public Response> cfInsert(String key, String... items) { - return appendCommand(commandObjects.cfInsert(key, items)); - } - - @Override - public Response> cfInsert(String key, CFInsertParams insertParams, String... items) { - return appendCommand(commandObjects.cfInsert(key, insertParams, items)); - } - - @Override - public Response> cfInsertNx(String key, String... items) { - return appendCommand(commandObjects.cfInsertNx(key, items)); - } - - @Override - public Response> cfInsertNx(String key, CFInsertParams insertParams, String... items) { - return appendCommand(commandObjects.cfInsertNx(key, insertParams, items)); - } - - @Override - public Response cfExists(String key, String item) { - return appendCommand(commandObjects.cfExists(key, item)); - } - - @Override - public Response cfDel(String key, String item) { - return appendCommand(commandObjects.cfDel(key, item)); - } - - @Override - public Response cfCount(String key, String item) { - return appendCommand(commandObjects.cfCount(key, item)); - } - - @Override - public Response> cfScanDump(String key, long iterator) { - return appendCommand(commandObjects.cfScanDump(key, iterator)); - } - - @Override - public Response cfLoadChunk(String key, long iterator, byte[] data) { - return appendCommand(commandObjects.cfLoadChunk(key, iterator, data)); - } - - @Override - public Response> cfInfo(String key) { - return appendCommand(commandObjects.cfInfo(key)); - } - - @Override - public Response cmsInitByDim(String key, long width, long depth) { - return appendCommand(commandObjects.cmsInitByDim(key, width, depth)); - } - - @Override - public Response cmsInitByProb(String key, double error, double probability) { - return appendCommand(commandObjects.cmsInitByProb(key, error, probability)); - } - - @Override - public Response> cmsIncrBy(String key, Map itemIncrements) { - return appendCommand(commandObjects.cmsIncrBy(key, itemIncrements)); - } - - @Override - public Response> cmsQuery(String key, String... items) { - return appendCommand(commandObjects.cmsQuery(key, items)); - } - - @Override - public Response cmsMerge(String destKey, String... keys) { - return appendCommand(commandObjects.cmsMerge(destKey, keys)); - } - - @Override - public Response cmsMerge(String destKey, Map keysAndWeights) { - return appendCommand(commandObjects.cmsMerge(destKey, keysAndWeights)); - } - - @Override - public Response> cmsInfo(String key) { - return appendCommand(commandObjects.cmsInfo(key)); - } - - @Override - public Response topkReserve(String key, long topk) { - return appendCommand(commandObjects.topkReserve(key, topk)); - } - - @Override - public Response topkReserve(String key, long topk, long width, long depth, double decay) { - return appendCommand(commandObjects.topkReserve(key, topk, width, depth, decay)); - } - - @Override - public Response> topkAdd(String key, String... items) { - return appendCommand(commandObjects.topkAdd(key, items)); - } - - @Override - public Response> topkIncrBy(String key, Map itemIncrements) { - return appendCommand(commandObjects.topkIncrBy(key, itemIncrements)); - } - - @Override - public Response> topkQuery(String key, String... items) { - return appendCommand(commandObjects.topkQuery(key, items)); - } - - @Override - public Response> topkList(String key) { - return appendCommand(commandObjects.topkList(key)); - } - - @Override - public Response> topkInfo(String key) { - return appendCommand(commandObjects.topkInfo(key)); - } - - @Override - public Response tdigestCreate(String key) { - return appendCommand(commandObjects.tdigestCreate(key)); - } - - @Override - public Response tdigestCreate(String key, int compression) { - return appendCommand(commandObjects.tdigestCreate(key, compression)); - } - - @Override - public Response tdigestReset(String key) { - return appendCommand(commandObjects.tdigestReset(key)); - } - - @Override - public Response tdigestMerge(String destinationKey, String... sourceKeys) { - return appendCommand(commandObjects.tdigestMerge(destinationKey, sourceKeys)); - } - - @Override - public Response tdigestMerge(TDigestMergeParams mergeParams, String destinationKey, String... sourceKeys) { - return appendCommand(commandObjects.tdigestMerge(mergeParams, destinationKey, sourceKeys)); - } - - @Override - public Response> tdigestInfo(String key) { - return appendCommand(commandObjects.tdigestInfo(key)); - } - - @Override - public Response tdigestAdd(String key, double... values) { - return appendCommand(commandObjects.tdigestAdd(key, values)); - } - - @Override - public Response> tdigestCDF(String key, double... values) { - return appendCommand(commandObjects.tdigestCDF(key, values)); - } - - @Override - public Response> tdigestQuantile(String key, double... quantiles) { - return appendCommand(commandObjects.tdigestQuantile(key, quantiles)); - } - - @Override - public Response tdigestMin(String key) { - return appendCommand(commandObjects.tdigestMin(key)); - } - - @Override - public Response tdigestMax(String key) { - return appendCommand(commandObjects.tdigestMax(key)); - } - - @Override - public Response tdigestTrimmedMean(String key, double lowCutQuantile, double highCutQuantile) { - return appendCommand(commandObjects.tdigestTrimmedMean(key, lowCutQuantile, highCutQuantile)); - } - - @Override - public Response> tdigestRank(String key, double... values) { - return appendCommand(commandObjects.tdigestRank(key, values)); - } - - @Override - public Response> tdigestRevRank(String key, double... values) { - return appendCommand(commandObjects.tdigestRevRank(key, values)); - } - - @Override - public Response> tdigestByRank(String key, long... ranks) { - return appendCommand(commandObjects.tdigestByRank(key, ranks)); - } - - @Override - public Response> tdigestByRevRank(String key, long... ranks) { - return appendCommand(commandObjects.tdigestByRevRank(key, ranks)); - } - // RedisBloom commands - - // RedisGraph commands - @Override - public Response graphQuery(String name, String query) { - return appendCommand(graphCommandObjects.graphQuery(name, query)); - } - - @Override - public Response graphReadonlyQuery(String name, String query) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query)); - } - - @Override - public Response graphQuery(String name, String query, long timeout) { - return appendCommand(graphCommandObjects.graphQuery(name, query, timeout)); - } - - @Override - public Response graphReadonlyQuery(String name, String query, long timeout) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, timeout)); - } - - @Override - public Response graphQuery(String name, String query, Map params) { - return appendCommand(graphCommandObjects.graphQuery(name, query, params)); - } - - @Override - public Response graphReadonlyQuery(String name, String query, Map params) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, params)); - } - - @Override - public Response graphQuery(String name, String query, Map params, long timeout) { - return appendCommand(graphCommandObjects.graphQuery(name, query, params, timeout)); - } - - @Override - public Response graphReadonlyQuery(String name, String query, Map params, long timeout) { - return appendCommand(graphCommandObjects.graphReadonlyQuery(name, query, params, timeout)); - } - - @Override - public Response graphDelete(String name) { - return appendCommand(graphCommandObjects.graphDelete(name)); - } - - @Override - public Response> graphProfile(String graphName, String query) { - return appendCommand(commandObjects.graphProfile(graphName, query)); - } - // RedisGraph commands - - public Response waitReplicas(int replicas, long timeout) { - return appendCommand(commandObjects.waitReplicas(replicas, timeout)); - } - - public Response sendCommand(ProtocolCommand cmd, String... args) { - return sendCommand(new CommandArguments(cmd).addObjects((Object[]) args)); - } - - public Response sendCommand(ProtocolCommand cmd, byte[]... args) { - return sendCommand(new CommandArguments(cmd).addObjects((Object[]) args)); - } - - public Response sendCommand(CommandArguments args) { - return executeCommand(new CommandObject<>(args, BuilderFactory.RAW_OBJECT)); - } - - public Response executeCommand(CommandObject command) { - return appendCommand(command); - } - - public void setJsonObjectMapper(JsonObjectMapper jsonObjectMapper) { - this.commandObjects.setJsonObjectMapper(jsonObjectMapper); +/** + * @deprecated Use {@link AbstractTransaction}. + */ +@Deprecated +public abstract class TransactionBase extends AbstractTransaction { + + protected TransactionBase() { + super(); } } diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index acf6ad7dfd..3ab2e43c88 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -19,12 +19,18 @@ import redis.clients.jedis.commands.RedisModuleCommands; import redis.clients.jedis.exceptions.JedisException; import redis.clients.jedis.executors.*; +import redis.clients.jedis.gears.TFunctionListParams; +import redis.clients.jedis.gears.TFunctionLoadParams; +import redis.clients.jedis.gears.resps.GearsLibraryInfo; import redis.clients.jedis.graph.GraphCommandObjects; import redis.clients.jedis.graph.ResultSet; import redis.clients.jedis.json.JsonSetParams; import redis.clients.jedis.json.Path; import redis.clients.jedis.json.Path2; import redis.clients.jedis.json.JsonObjectMapper; +import redis.clients.jedis.mcf.CircuitBreakerCommandExecutor; +import redis.clients.jedis.mcf.MultiClusterPipeline; +import redis.clients.jedis.mcf.MultiClusterTransaction; import redis.clients.jedis.params.*; import redis.clients.jedis.providers.*; import redis.clients.jedis.resps.*; @@ -3055,22 +3061,22 @@ public long xlen(byte[] key) { } @Override - public List xrange(byte[] key, byte[] start, byte[] end) { + public List xrange(byte[] key, byte[] start, byte[] end) { return executeCommand(commandObjects.xrange(key, start, end)); } @Override - public List xrange(byte[] key, byte[] start, byte[] end, int count) { + public List xrange(byte[] key, byte[] start, byte[] end, int count) { return executeCommand(commandObjects.xrange(key, start, end, count)); } @Override - public List xrevrange(byte[] key, byte[] end, byte[] start) { + public List xrevrange(byte[] key, byte[] end, byte[] start) { return executeCommand(commandObjects.xrevrange(key, end, start)); } @Override - public List xrevrange(byte[] key, byte[] end, byte[] start, int count) { + public List xrevrange(byte[] key, byte[] end, byte[] start, int count) { return executeCommand(commandObjects.xrevrange(key, end, start, count)); } @@ -3175,12 +3181,12 @@ public List xinfoConsumers(byte[] key, byte[] group) { } @Override - public List xread(XReadParams xReadParams, Map.Entry... streams) { + public List xread(XReadParams xReadParams, Map.Entry... streams) { return executeCommand(commandObjects.xread(xReadParams, streams)); } @Override - public List xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Map.Entry... streams) { + public List xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Map.Entry... streams) { return executeCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); } // Stream commands @@ -3318,12 +3324,12 @@ public List functionListWithCode(String libraryNamePattern) { @Override public String functionLoad(String functionCode) { - return executeCommand(commandObjects.functionLoad(functionCode)); + return checkAndBroadcastCommand(commandObjects.functionLoad(functionCode)); } @Override public String functionLoadReplace(String functionCode) { - return executeCommand(commandObjects.functionLoadReplace(functionCode)); + return checkAndBroadcastCommand(commandObjects.functionLoadReplace(functionCode)); } @Override @@ -3373,12 +3379,12 @@ public List functionListWithCode(final byte[] libraryNamePattern) { @Override public String functionLoad(byte[] functionCode) { - return executeCommand(commandObjects.functionLoad(functionCode)); + return checkAndBroadcastCommand(commandObjects.functionLoad(functionCode)); } @Override public String functionLoadReplace(byte[] functionCode) { - return executeCommand(commandObjects.functionLoadReplace(functionCode)); + return checkAndBroadcastCommand(commandObjects.functionLoadReplace(functionCode)); } @Override @@ -3616,6 +3622,14 @@ public void psubscribe(BinaryJedisPubSub jedisPubSub, final byte[]... patterns) // Random node commands // RediSearch commands + public long hsetObject(String key, String field, Object value) { + return executeCommand(commandObjects.hsetObject(key, field, value)); + } + + public long hsetObject(String key, Map hash) { + return executeCommand(commandObjects.hsetObject(key, hash)); + } + @Override public String ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { return checkAndBroadcastCommand(commandObjects.ftCreate(indexName, indexOptions, schema)); @@ -3636,6 +3650,31 @@ public String ftAlter(String indexName, Iterable schemaFields) { return checkAndBroadcastCommand(commandObjects.ftAlter(indexName, schemaFields)); } + @Override + public String ftAliasAdd(String aliasName, String indexName) { + return checkAndBroadcastCommand(commandObjects.ftAliasAdd(aliasName, indexName)); + } + + @Override + public String ftAliasUpdate(String aliasName, String indexName) { + return checkAndBroadcastCommand(commandObjects.ftAliasUpdate(aliasName, indexName)); + } + + @Override + public String ftAliasDel(String aliasName) { + return checkAndBroadcastCommand(commandObjects.ftAliasDel(aliasName)); + } + + @Override + public String ftDropIndex(String indexName) { + return checkAndBroadcastCommand(commandObjects.ftDropIndex(indexName)); + } + + @Override + public String ftDropIndexDD(String indexName) { + return checkAndBroadcastCommand(commandObjects.ftDropIndexDD(indexName)); + } + @Override public SearchResult ftSearch(String indexName, String query) { return executeCommand(commandObjects.ftSearch(indexName, query)); @@ -3655,7 +3694,7 @@ public SearchResult ftSearch(String indexName, String query, FTSearchParams para * @return search iteration */ public FtSearchIteration ftSearchIteration(int batchSize, String indexName, String query, FTSearchParams params) { - return new FtSearchIteration(provider, batchSize, indexName, query, params); + return new FtSearchIteration(provider, commandObjects.getProtocol(), batchSize, indexName, query, params); } @Override @@ -3671,10 +3710,11 @@ public SearchResult ftSearch(String indexName, Query query) { * @return search iteration */ public FtSearchIteration ftSearchIteration(int batchSize, String indexName, Query query) { - return new FtSearchIteration(provider, batchSize, indexName, query); + return new FtSearchIteration(provider, commandObjects.getProtocol(), batchSize, indexName, query); } @Override + @Deprecated public SearchResult ftSearch(byte[] indexName, Query query) { return executeCommand(commandObjects.ftSearch(indexName, query)); } @@ -3732,16 +3772,6 @@ public Map.Entry> ftProfileSearch(String index return executeCommand(commandObjects.ftProfileSearch(indexName, profileParams, query, searchParams)); } - @Override - public String ftDropIndex(String indexName) { - return checkAndBroadcastCommand(commandObjects.ftDropIndex(indexName)); - } - - @Override - public String ftDropIndexDD(String indexName) { - return checkAndBroadcastCommand(commandObjects.ftDropIndexDD(indexName)); - } - @Override public String ftSynUpdate(String indexName, String synonymGroupId, String... terms) { return executeCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms)); @@ -3803,27 +3833,12 @@ public Set ftTagVals(String indexName, String fieldName) { } @Override - public String ftAliasAdd(String aliasName, String indexName) { - return checkAndBroadcastCommand(commandObjects.ftAliasAdd(aliasName, indexName)); - } - - @Override - public String ftAliasUpdate(String aliasName, String indexName) { - return checkAndBroadcastCommand(commandObjects.ftAliasUpdate(aliasName, indexName)); - } - - @Override - public String ftAliasDel(String aliasName) { - return checkAndBroadcastCommand(commandObjects.ftAliasDel(aliasName)); - } - - @Override - public Map ftConfigGet(String option) { + public Map ftConfigGet(String option) { return executeCommand(commandObjects.ftConfigGet(option)); } @Override - public Map ftConfigGet(String indexName, String option) { + public Map ftConfigGet(String indexName, String option) { return executeCommand(commandObjects.ftConfigGet(indexName, option)); } @@ -3878,7 +3893,7 @@ public long ftSugLen(String key) { } @Override - public List ftList() { + public Set ftList() { return executeCommand(commandObjects.ftList()); } // RediSearch commands @@ -3895,11 +3910,13 @@ public String jsonSetWithEscape(String key, Path2 path, Object object) { } @Override + @Deprecated public String jsonSet(String key, Path path, Object pojo) { return executeCommand(commandObjects.jsonSet(key, path, pojo)); } @Override + @Deprecated public String jsonSetWithPlainString(String key, Path path, String string) { return executeCommand(commandObjects.jsonSetWithPlainString(key, path, string)); } @@ -3915,6 +3932,7 @@ public String jsonSetWithEscape(String key, Path2 path, Object pojo, JsonSetPara } @Override + @Deprecated public String jsonSet(String key, Path path, Object pojo, JsonSetParams params) { return executeCommand(commandObjects.jsonSet(key, path, pojo, params)); } @@ -3925,6 +3943,7 @@ public String jsonMerge(String key, Path2 path, Object object) { } @Override + @Deprecated public String jsonMerge(String key, Path path, Object pojo) { return executeCommand(commandObjects.jsonMerge(key, path, pojo)); } @@ -3935,6 +3954,7 @@ public Object jsonGet(String key) { } @Override + @Deprecated public T jsonGet(String key, Class clazz) { return executeCommand(commandObjects.jsonGet(key, clazz)); } @@ -3945,16 +3965,19 @@ public Object jsonGet(String key, Path2... paths) { } @Override + @Deprecated public Object jsonGet(String key, Path... paths) { return executeCommand(commandObjects.jsonGet(key, paths)); } @Override + @Deprecated public String jsonGetAsPlainString(String key, Path path) { return executeCommand(commandObjects.jsonGetAsPlainString(key, path)); } @Override + @Deprecated public T jsonGet(String key, Class clazz, Path... paths) { return executeCommand(commandObjects.jsonGet(key, clazz, paths)); } @@ -3965,6 +3988,7 @@ public List jsonMGet(Path2 path, String... keys) { } @Override + @Deprecated public List jsonMGet(Path path, Class clazz, String... keys) { return executeCommand(commandObjects.jsonMGet(path, clazz, keys)); } @@ -3980,6 +4004,7 @@ public long jsonDel(String key, Path2 path) { } @Override + @Deprecated public long jsonDel(String key, Path path) { return executeCommand(commandObjects.jsonDel(key, path)); } @@ -3995,6 +4020,7 @@ public long jsonClear(String key, Path2 path) { } @Override + @Deprecated public long jsonClear(String key, Path path) { return executeCommand(commandObjects.jsonClear(key, path)); } @@ -4005,11 +4031,13 @@ public List jsonToggle(String key, Path2 path) { } @Override + @Deprecated public String jsonToggle(String key, Path path) { return executeCommand(commandObjects.jsonToggle(key, path)); } @Override + @Deprecated public Class jsonType(String key) { return executeCommand(commandObjects.jsonType(key)); } @@ -4020,11 +4048,13 @@ public List> jsonType(String key, Path2 path) { } @Override + @Deprecated public Class jsonType(String key, Path path) { return executeCommand(commandObjects.jsonType(key, path)); } @Override + @Deprecated public long jsonStrAppend(String key, Object string) { return executeCommand(commandObjects.jsonStrAppend(key, string)); } @@ -4035,11 +4065,13 @@ public List jsonStrAppend(String key, Path2 path, Object string) { } @Override + @Deprecated public long jsonStrAppend(String key, Path path, Object string) { return executeCommand(commandObjects.jsonStrAppend(key, path, string)); } @Override + @Deprecated public Long jsonStrLen(String key) { return executeCommand(commandObjects.jsonStrLen(key)); } @@ -4050,16 +4082,18 @@ public List jsonStrLen(String key, Path2 path) { } @Override + @Deprecated public Long jsonStrLen(String key, Path path) { return executeCommand(commandObjects.jsonStrLen(key, path)); } @Override - public JSONArray jsonNumIncrBy(String key, Path2 path, double value) { + public Object jsonNumIncrBy(String key, Path2 path, double value) { return executeCommand(commandObjects.jsonNumIncrBy(key, path, value)); } @Override + @Deprecated public double jsonNumIncrBy(String key, Path path, double value) { return executeCommand(commandObjects.jsonNumIncrBy(key, path, value)); } @@ -4075,6 +4109,7 @@ public List jsonArrAppendWithEscape(String key, Path2 path, Object... obje } @Override + @Deprecated public Long jsonArrAppend(String key, Path path, Object... pojos) { return executeCommand(commandObjects.jsonArrAppend(key, path, pojos)); } @@ -4090,6 +4125,7 @@ public List jsonArrIndexWithEscape(String key, Path2 path, Object scalar) } @Override + @Deprecated public long jsonArrIndex(String key, Path path, Object scalar) { return executeCommand(commandObjects.jsonArrIndex(key, path, scalar)); } @@ -4105,16 +4141,19 @@ public List jsonArrInsertWithEscape(String key, Path2 path, int index, Obj } @Override + @Deprecated public long jsonArrInsert(String key, Path path, int index, Object... pojos) { return executeCommand(commandObjects.jsonArrInsert(key, path, index, pojos)); } @Override + @Deprecated public Object jsonArrPop(String key) { return executeCommand(commandObjects.jsonArrPop(key)); } @Override + @Deprecated public T jsonArrPop(String key, Class clazz) { return executeCommand(commandObjects.jsonArrPop(key, clazz)); } @@ -4125,11 +4164,13 @@ public List jsonArrPop(String key, Path2 path) { } @Override + @Deprecated public Object jsonArrPop(String key, Path path) { return executeCommand(commandObjects.jsonArrPop(key, path)); } @Override + @Deprecated public T jsonArrPop(String key, Class clazz, Path path) { return executeCommand(commandObjects.jsonArrPop(key, clazz, path)); } @@ -4140,16 +4181,19 @@ public List jsonArrPop(String key, Path2 path, int index) { } @Override + @Deprecated public Object jsonArrPop(String key, Path path, int index) { return executeCommand(commandObjects.jsonArrPop(key, path, index)); } @Override + @Deprecated public T jsonArrPop(String key, Class clazz, Path path, int index) { return executeCommand(commandObjects.jsonArrPop(key, clazz, path, index)); } @Override + @Deprecated public Long jsonArrLen(String key) { return executeCommand(commandObjects.jsonArrLen(key)); } @@ -4160,6 +4204,7 @@ public List jsonArrLen(String key, Path2 path) { } @Override + @Deprecated public Long jsonArrLen(String key, Path path) { return executeCommand(commandObjects.jsonArrLen(key, path)); } @@ -4170,16 +4215,19 @@ public List jsonArrTrim(String key, Path2 path, int start, int stop) { } @Override + @Deprecated public Long jsonArrTrim(String key, Path path, int start, int stop) { return executeCommand(commandObjects.jsonArrTrim(key, path, start, stop)); } @Override + @Deprecated public Long jsonObjLen(String key) { return executeCommand(commandObjects.jsonObjLen(key)); } @Override + @Deprecated public Long jsonObjLen(String key, Path path) { return executeCommand(commandObjects.jsonObjLen(key, path)); } @@ -4190,11 +4238,13 @@ public List jsonObjLen(String key, Path2 path) { } @Override + @Deprecated public List jsonObjKeys(String key) { return executeCommand(commandObjects.jsonObjKeys(key)); } @Override + @Deprecated public List jsonObjKeys(String key, Path path) { return executeCommand(commandObjects.jsonObjKeys(key, path)); } @@ -4205,11 +4255,13 @@ public List> jsonObjKeys(String key, Path2 path) { } @Override + @Deprecated public long jsonDebugMemory(String key) { return executeCommand(commandObjects.jsonDebugMemory(key)); } @Override + @Deprecated public long jsonDebugMemory(String key, Path path) { return executeCommand(commandObjects.jsonDebugMemory(key, path)); } @@ -4218,21 +4270,6 @@ public long jsonDebugMemory(String key, Path path) { public List jsonDebugMemory(String key, Path2 path) { return executeCommand(commandObjects.jsonDebugMemory(key, path)); } - - @Override - public List jsonResp(String key) { - return executeCommand(commandObjects.jsonResp(key)); - } - - @Override - public List jsonResp(String key, Path path) { - return executeCommand(commandObjects.jsonResp(key, path)); - } - - @Override - public List> jsonResp(String key, Path2 path) { - return executeCommand(commandObjects.jsonResp(key, path)); - } // RedisJSON commands // RedisTimeSeries commands @@ -4583,6 +4620,11 @@ public List topkList(String key) { return executeCommand(commandObjects.topkList(key)); } + @Override + public Map topkListWithCount(String key) { + return executeCommand(commandObjects.topkListWithCount(key)); + } + @Override public Map topkInfo(String key) { return executeCommand(commandObjects.topkInfo(key)); @@ -4671,93 +4713,144 @@ public List tdigestByRevRank(String key, long... ranks) { // RedisGraph commands @Override + @Deprecated public ResultSet graphQuery(String name, String query) { return executeCommand(graphCommandObjects.graphQuery(name, query)); } @Override + @Deprecated public ResultSet graphReadonlyQuery(String name, String query) { return executeCommand(graphCommandObjects.graphReadonlyQuery(name, query)); } @Override + @Deprecated public ResultSet graphQuery(String name, String query, long timeout) { return executeCommand(graphCommandObjects.graphQuery(name, query, timeout)); } @Override + @Deprecated public ResultSet graphReadonlyQuery(String name, String query, long timeout) { return executeCommand(graphCommandObjects.graphReadonlyQuery(name, query, timeout)); } @Override + @Deprecated public ResultSet graphQuery(String name, String query, Map params) { return executeCommand(graphCommandObjects.graphQuery(name, query, params)); } @Override + @Deprecated public ResultSet graphReadonlyQuery(String name, String query, Map params) { return executeCommand(graphCommandObjects.graphReadonlyQuery(name, query, params)); } @Override + @Deprecated public ResultSet graphQuery(String name, String query, Map params, long timeout) { return executeCommand(graphCommandObjects.graphQuery(name, query, params, timeout)); } @Override + @Deprecated public ResultSet graphReadonlyQuery(String name, String query, Map params, long timeout) { return executeCommand(graphCommandObjects.graphReadonlyQuery(name, query, params, timeout)); } @Override + @Deprecated public String graphDelete(String name) { return executeCommand(graphCommandObjects.graphDelete(name)); } @Override + @Deprecated public List graphList() { return executeCommand(commandObjects.graphList()); } @Override + @Deprecated public List graphProfile(String graphName, String query) { return executeCommand(commandObjects.graphProfile(graphName, query)); } @Override + @Deprecated public List graphExplain(String graphName, String query) { return executeCommand(commandObjects.graphExplain(graphName, query)); } @Override + @Deprecated public List> graphSlowlog(String graphName) { return executeCommand(commandObjects.graphSlowlog(graphName)); } @Override + @Deprecated public String graphConfigSet(String configName, Object value) { return executeCommand(commandObjects.graphConfigSet(configName, value)); } @Override + @Deprecated public Map graphConfigGet(String configName) { return executeCommand(commandObjects.graphConfigGet(configName)); } // RedisGraph commands + // RedisGears commands + @Override + public String tFunctionLoad(String libraryCode, TFunctionLoadParams params) { + return executeCommand(commandObjects.tFunctionLoad(libraryCode, params)); + } + + @Override + public String tFunctionDelete(String libraryName) { + return executeCommand(commandObjects.tFunctionDelete(libraryName)); + } + + @Override + public List tFunctionList(TFunctionListParams params) { + return executeCommand(commandObjects.tFunctionList(params)); + } + + @Override + public Object tFunctionCall(String library, String function, List keys, List args) { + return executeCommand(commandObjects.tFunctionCall(library, function, keys, args)); + } + + @Override + public Object tFunctionCallAsync(String library, String function, List keys, List args) { + return executeCommand(commandObjects.tFunctionCallAsync(library, function, keys, args)); + } + // RedisGears commands + + /** + * @return pipeline object. Use {@link AbstractPipeline} instead of {@link PipelineBase}. + */ public PipelineBase pipelined() { if (provider == null) { throw new IllegalStateException("It is not allowed to create Pipeline from this " + getClass()); + } else if (provider instanceof MultiClusterPooledConnectionProvider) { + return new MultiClusterPipeline((MultiClusterPooledConnectionProvider) provider); + } else { + return new Pipeline(provider.getConnection(), true); } - return new Pipeline(provider.getConnection(), true); } - public Transaction multi() { + public AbstractTransaction multi() { if (provider == null) { throw new IllegalStateException("It is not allowed to create Pipeline from this " + getClass()); + } else if (provider instanceof MultiClusterPooledConnectionProvider) { + return new MultiClusterTransaction((MultiClusterPooledConnectionProvider) provider); + } else { + return new Transaction(provider.getConnection(), true, true); } - return new Transaction(provider.getConnection(), true, true); } public Object sendCommand(ProtocolCommand cmd) { diff --git a/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java b/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java index 7e7bb810f2..c60b9fcc4a 100644 --- a/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java +++ b/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java @@ -120,7 +120,7 @@ public byte[] getRaw() { public enum RedisBloomKeyword implements Rawable { CAPACITY, ERROR, NOCREATE, EXPANSION, NONSCALING, BUCKETSIZE, MAXITERATIONS, ITEMS, WEIGHTS, - COMPRESSION, OVERRIDE; + COMPRESSION, OVERRIDE, WITHCOUNT; private final byte[] raw; diff --git a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java index 6cc2f47b43..d16e31a72f 100644 --- a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java +++ b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java @@ -1,5 +1,6 @@ package redis.clients.jedis.bloom.commands; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -35,6 +36,18 @@ public interface TopKFilterCommands { */ List topkAdd(String key, String... items); + /** + * {@code TOPK.INCRBY {key} {item} {increment}} + * + * @param key + * @param item + * @param increment + * @return item dropped from list + */ + default String topkIncrBy(String key, String item, long increment) { + return topkIncrBy(key, Collections.singletonMap(item, increment)).get(0); + } + /** * {@code TOPK.INCRBY {key} {item} {increment} [{item} {increment} ...]} * @@ -61,6 +74,14 @@ public interface TopKFilterCommands { */ List topkList(String key); + /** + * {@code TOPK.LIST {key} WITHCOUNT} + * + * @param key + * @return k (or less) items in Top K list + */ + Map topkListWithCount(String key); + /** * {@code TOPK.INFO {key}} * diff --git a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java index 692e02d3c9..d75b3d7447 100644 --- a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java @@ -18,5 +18,7 @@ public interface TopKFilterPipelineCommands { Response> topkList(String key); + Response> topkListWithCount(String key); + Response> topkInfo(String key); } diff --git a/src/main/java/redis/clients/jedis/commands/ClientBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/ClientBinaryCommands.java index 32efb7fe25..ef32730a1a 100644 --- a/src/main/java/redis/clients/jedis/commands/ClientBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ClientBinaryCommands.java @@ -46,7 +46,7 @@ public interface ClientBinaryCommands { /** * Returns information and statistics about the client connections server - * in a mostly human readable format. + * in a mostly human-readable format. * * @return All clients info connected to redis-server */ @@ -54,7 +54,7 @@ public interface ClientBinaryCommands { /** * Returns information and statistics about the client connections server - * in a mostly human readable format filter by client type. + * in a mostly human-readable format filter by client type. * * @return all clients info connected to redis-server */ @@ -62,7 +62,7 @@ public interface ClientBinaryCommands { /** * Returns information and statistics about the client connections server - * in a mostly human readable format filter by client ids. + * in a mostly human-readable format filter by client ids. * * @param clientIds Unique 64-bit client IDs * @return All clients info connected to redis-server @@ -71,7 +71,7 @@ public interface ClientBinaryCommands { /** * Returns information and statistics about the current client connection - * in a mostly human readable format. + * in a mostly human-readable format. * * @return Information and statistics about the current client connection */ diff --git a/src/main/java/redis/clients/jedis/commands/ClientCommands.java b/src/main/java/redis/clients/jedis/commands/ClientCommands.java index 537fa417d8..edcfbd602e 100644 --- a/src/main/java/redis/clients/jedis/commands/ClientCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ClientCommands.java @@ -46,7 +46,7 @@ public interface ClientCommands { /** * Returns information and statistics about the client connections server - * in a mostly human readable format. + * in a mostly human-readable format. * * @return All clients info connected to redis-server */ @@ -54,7 +54,7 @@ public interface ClientCommands { /** * Returns information and statistics about the client connections server - * in a mostly human readable format filter by client type. + * in a mostly human-readable format filter by client type. * * @return All clients info connected to redis-server */ @@ -62,7 +62,7 @@ public interface ClientCommands { /** * Returns information and statistics about the client connections server - * in a mostly human readable format filter by client ids. + * in a mostly human-readable format filter by client ids. * * @param clientIds Unique 64-bit client IDs * @return All clients info connected to redis-server @@ -71,7 +71,7 @@ public interface ClientCommands { /** * Returns information and statistics about the current client connection - * in a mostly human readable format. + * in a mostly human-readable format. * * @return Information and statistics about the current client connection */ diff --git a/src/main/java/redis/clients/jedis/commands/ClusterCommands.java b/src/main/java/redis/clients/jedis/commands/ClusterCommands.java index 7a052146eb..4ad918d12b 100644 --- a/src/main/java/redis/clients/jedis/commands/ClusterCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ClusterCommands.java @@ -5,6 +5,7 @@ import redis.clients.jedis.args.ClusterResetType; import redis.clients.jedis.args.ClusterFailoverOption; +import redis.clients.jedis.resps.ClusterShardInfo; public interface ClusterCommands { @@ -79,8 +80,24 @@ public interface ClusterCommands { String clusterFailover(ClusterFailoverOption failoverOption); + /** + * {@code CLUSTER SLOTS} command is deprecated since Redis 7. + * + * @deprecated Use {@link ClusterCommands#clusterShards()}. + */ + @Deprecated List clusterSlots(); + /** + * {@code CLUSTER SHARDS} returns details about the shards of the cluster. + * This command replaces the {@code CLUSTER SLOTS} command from Redis 7, + * by providing a more efficient and extensible representation of the cluster. + * + * @return a list of shards, with each shard containing two objects, 'slots' and 'nodes'. + * @see CLUSTER SHARDS + */ + List clusterShards(); + String clusterReset(); /** @@ -108,7 +125,7 @@ public interface ClusterCommands { * Takes a list of slot ranges (specified by start and end slots) to assign to the node * * @param ranges slots range - * @return OK if the command was successful. Otherwise an error is returned. + * @return OK if the command was successful. Otherwise, an error is returned. */ String clusterAddSlotsRange(int... ranges); @@ -116,7 +133,7 @@ public interface ClusterCommands { * Takes a list of slot ranges (specified by start and end slots) to remove to the node. * * @param ranges slots range - * @return OK if the command was successful. Otherwise an error is returned. + * @return OK if the command was successful. Otherwise, an error is returned. */ String clusterDelSlotsRange(int... ranges); } diff --git a/src/main/java/redis/clients/jedis/commands/RedisModuleCommands.java b/src/main/java/redis/clients/jedis/commands/RedisModuleCommands.java index c4b785fc70..5e67838720 100644 --- a/src/main/java/redis/clients/jedis/commands/RedisModuleCommands.java +++ b/src/main/java/redis/clients/jedis/commands/RedisModuleCommands.java @@ -1,6 +1,7 @@ package redis.clients.jedis.commands; import redis.clients.jedis.bloom.commands.RedisBloomCommands; +import redis.clients.jedis.gears.RedisGearsCommands; import redis.clients.jedis.graph.RedisGraphCommands; import redis.clients.jedis.json.commands.RedisJsonCommands; import redis.clients.jedis.search.RediSearchCommands; @@ -11,6 +12,7 @@ public interface RedisModuleCommands extends RedisJsonCommands, RedisTimeSeriesCommands, RedisBloomCommands, - RedisGraphCommands { + RedisGraphCommands, + RedisGearsCommands { } diff --git a/src/main/java/redis/clients/jedis/commands/ServerCommands.java b/src/main/java/redis/clients/jedis/commands/ServerCommands.java index d96074379b..511357ac1d 100644 --- a/src/main/java/redis/clients/jedis/commands/ServerCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ServerCommands.java @@ -70,7 +70,7 @@ public interface ServerCommands { * The SAVE commands performs a synchronous save of the dataset producing a point in time snapshot * of all the data inside the Redis instance, in the form of an RDB file. You almost never want to * call SAVE in production environments where it will block all the other clients. Instead usually - * BGSAVE is used. However in case of issues preventing Redis to create the background saving + * BGSAVE is used. However, in case of issues preventing Redis to create the background saving * child (for instance errors in the fork(2) system call), the SAVE command can be a good last * resort to perform the dump of the latest dataset. * @return result of the save @@ -229,6 +229,8 @@ default void shutdown(SaveMode saveMode) throws JedisException { String lolwut(LolwutParams lolwutParams); + String reset(); + /** * The LATENCY DOCTOR command reports about different latency-related issues and advises about * possible remedies. diff --git a/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java index 0b43ebbcc3..01dec14d2d 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java @@ -15,13 +15,13 @@ default byte[] xadd(byte[] key, Map hash, XAddParams params) { long xlen(byte[] key); - List xrange(byte[] key, byte[] start, byte[] end); + List xrange(byte[] key, byte[] start, byte[] end); - List xrange(byte[] key, byte[] start, byte[] end, int count); + List xrange(byte[] key, byte[] start, byte[] end, int count); - List xrevrange(byte[] key, byte[] end, byte[] start); + List xrevrange(byte[] key, byte[] end, byte[] start); - List xrevrange(byte[] key, byte[] end, byte[] start, int count); + List xrevrange(byte[] key, byte[] end, byte[] start, int count); long xack(byte[] key, byte[] group, byte[]... ids); @@ -74,9 +74,9 @@ List xautoclaimJustId(byte[] key, byte[] groupName, byte[] consumerName, List xinfoConsumers(byte[] key, byte[] group); - List xread(XReadParams xReadParams, Map.Entry... streams); + List xread(XReadParams xReadParams, Map.Entry... streams); - List xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, + List xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Map.Entry... streams); } diff --git a/src/main/java/redis/clients/jedis/commands/StreamCommands.java b/src/main/java/redis/clients/jedis/commands/StreamCommands.java index 9e258e4b46..9c34cbc6a6 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamCommands.java @@ -123,16 +123,6 @@ default StreamEntryID xadd(String key, Map hash, XAddParams para */ long xgroupDelConsumer(String key, String groupName, String consumerName); - /** - * XPENDING key group - */ - StreamPendingSummary xpending(String key, String groupName); - - /** - * XPENDING key group [[IDLE min-idle-time] start end count [consumer]] - */ - List xpending(String key, String groupName, XPendingParams params); - /** * XDEL key ID [ID ...] */ @@ -148,6 +138,16 @@ default StreamEntryID xadd(String key, Map hash, XAddParams para */ long xtrim(String key, XTrimParams params); + /** + * XPENDING key group + */ + StreamPendingSummary xpending(String key, String groupName); + + /** + * XPENDING key group [[IDLE min-idle-time] start end count [consumer]] + */ + List xpending(String key, String groupName, XPendingParams params); + /** * {@code XCLAIM key group consumer min-idle-time ... * [IDLE ] [TIME ] [RETRYCOUNT ] @@ -226,7 +226,7 @@ Map.Entry> xautoclaimJustId(String key, Strin * @param key Stream name * @param group Group name * @return List of {@link StreamConsumersInfo} containing information about consumers that belong - * to the the group + * to the group * @deprecated Use {@link #xinfoConsumers2(java.lang.String, java.lang.String)}. */ @Deprecated // keep it till at least Jedis 6/7 @@ -237,7 +237,7 @@ Map.Entry> xautoclaimJustId(String key, Strin * @param key Stream name * @param group Group name * @return List of {@link StreamConsumerInfo} containing information about consumers that belong - * to the the group + * to the group */ List xinfoConsumers2(String key, String group); diff --git a/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java index 8acb88a049..8198443009 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java @@ -16,13 +16,13 @@ default Response xadd(byte[] key, Map hash, XAddParams p Response xlen(byte[] key); - Response> xrange(byte[] key, byte[] start, byte[] end); + Response> xrange(byte[] key, byte[] start, byte[] end); - Response> xrange(byte[] key, byte[] start, byte[] end, int count); + Response> xrange(byte[] key, byte[] start, byte[] end, int count); - Response> xrevrange(byte[] key, byte[] end, byte[] start); + Response> xrevrange(byte[] key, byte[] end, byte[] start); - Response> xrevrange(byte[] key, byte[] end, byte[] start, int count); + Response> xrevrange(byte[] key, byte[] end, byte[] start, int count); Response xack(byte[] key, byte[] group, byte[]... ids); @@ -75,9 +75,9 @@ Response> xautoclaimJustId(byte[] key, byte[] groupName, byte[] con Response> xinfoConsumers(byte[] key, byte[] group); - Response> xread(XReadParams xReadParams, Map.Entry... streams); + Response> xread(XReadParams xReadParams, Map.Entry... streams); - Response> xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, - Map.Entry... streams); + Response> xreadGroup(byte[] groupName, byte[] consumer, + XReadGroupParams xReadGroupParams, Map.Entry... streams); } diff --git a/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java index 2b11f833dd..e435c02341 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java @@ -219,7 +219,7 @@ Response>> xautoclaimJustId(String * @param key Stream name * @param group Group name * @return List of {@link StreamConsumersInfo} containing information about consumers that belong - * to the the group + * to the group * @deprecated Use {@link #xinfoConsumers2(java.lang.String, java.lang.String)}. */ @Deprecated // keep it till at least Jedis 6/7 @@ -230,7 +230,7 @@ Response>> xautoclaimJustId(String * @param key Stream name * @param group Group name * @return List of {@link StreamConsumerInfo} containing information about consumers that belong - * to the the group + * to the group */ Response> xinfoConsumers2(String key, String group); diff --git a/src/main/java/redis/clients/jedis/commands/StringCommands.java b/src/main/java/redis/clients/jedis/commands/StringCommands.java index 9e30e8489d..0621bc9334 100644 --- a/src/main/java/redis/clients/jedis/commands/StringCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringCommands.java @@ -172,7 +172,7 @@ public interface StringCommands extends BitCommands { /** * MSet Command - * Set the the respective keys to the respective values. MSET will replace old values with new + * Set the respective keys to the respective values. MSET will replace old values with new * values, while {@link StringCommands#msetnx(String...) MSETNX} will not perform any operation at all even * if just a single key already exists. *

@@ -213,10 +213,10 @@ public interface StringCommands extends BitCommands { * Increment the number stored at key by one. If the key does not exist or contains a value of a * wrong type, set the key to the value of "0" before to perform the increment operation. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -230,10 +230,10 @@ public interface StringCommands extends BitCommands { * INCRBY work just like {@link StringCommands#incr(String) INCR} but instead to increment by 1 the * increment is integer. *

- * INCR commands are limited to 64 bit signed integers. + * INCR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -267,10 +267,10 @@ public interface StringCommands extends BitCommands { * Decrement the number stored at key by one. If the key does not exist or contains a value of a * wrong type, set the key to the value of "0" before to perform the decrement operation. *

- * DECR commands are limited to 64 bit signed integers. + * DECR commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) @@ -284,10 +284,10 @@ public interface StringCommands extends BitCommands { * DECRBY work just like {@link StringCommands#decr(String) DECR} but instead to decrement by 1 the * decrement is integer. *

- * DECRBY commands are limited to 64 bit signed integers. + * DECRBY commands are limited to 64-bit signed integers. *

* Note: this is actually a string operation, that is, in Redis there are not "integer" types. - * Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, + * Simply the string stored at the key is parsed as a base 10 64-bit signed integer, incremented, * and then converted back as a string. *

* Time complexity: O(1) diff --git a/src/main/java/redis/clients/jedis/exceptions/AbortedTransactionException.java b/src/main/java/redis/clients/jedis/exceptions/AbortedTransactionException.java deleted file mode 100644 index 25f857a6c0..0000000000 --- a/src/main/java/redis/clients/jedis/exceptions/AbortedTransactionException.java +++ /dev/null @@ -1,16 +0,0 @@ -package redis.clients.jedis.exceptions; - -public class AbortedTransactionException extends JedisDataException { - - public AbortedTransactionException(final String message) { - super(message); - } - - public AbortedTransactionException(final Throwable cause) { - super(cause); - } - - public AbortedTransactionException(final String message, final Throwable cause) { - super(message, cause); - } -} diff --git a/src/main/java/redis/clients/jedis/exceptions/JedisBroadcastException.java b/src/main/java/redis/clients/jedis/exceptions/JedisBroadcastException.java index d0670a2c85..172449c34d 100644 --- a/src/main/java/redis/clients/jedis/exceptions/JedisBroadcastException.java +++ b/src/main/java/redis/clients/jedis/exceptions/JedisBroadcastException.java @@ -1,5 +1,6 @@ package redis.clients.jedis.exceptions; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import redis.clients.jedis.HostAndPort; @@ -8,45 +9,22 @@ * Note: This exception extends {@link JedisDataException} just so existing applications catching * JedisDataException do not get broken. */ +// TODO: extends JedisException public class JedisBroadcastException extends JedisDataException { private static final String BROADCAST_ERROR_MESSAGE = "A failure occurred while broadcasting the command."; - private final Map replies = new HashMap<>(); + private final Map replies = new HashMap<>(); public JedisBroadcastException() { super(BROADCAST_ERROR_MESSAGE); } public void addReply(HostAndPort node, Object reply) { - replies.put(node, new SingleReply(reply)); + replies.put(node, reply); } - public void addError(HostAndPort node, JedisDataException error) { - replies.put(node, new SingleReply(error)); - } - - public static class SingleReply { - - private final Object reply; - private final JedisDataException error; - - public SingleReply(Object reply) { - this.reply = reply; - this.error = null; - } - - public SingleReply(JedisDataException error) { - this.reply = null; - this.error = error; - } - - public Object getReply() { - return reply; - } - - public JedisDataException getError() { - return error; - } + public Map getReplies() { + return Collections.unmodifiableMap(replies); } } diff --git a/src/main/java/redis/clients/jedis/executors/ClusterCommandExecutor.java b/src/main/java/redis/clients/jedis/executors/ClusterCommandExecutor.java index 48ed4cd6a0..4cc25c42a9 100644 --- a/src/main/java/redis/clients/jedis/executors/ClusterCommandExecutor.java +++ b/src/main/java/redis/clients/jedis/executors/ClusterCommandExecutor.java @@ -43,30 +43,29 @@ public final T broadcastCommand(CommandObject commandObject) { boolean isErrored = false; T reply = null; - JedisBroadcastException holder = new JedisBroadcastException(); + JedisBroadcastException bcastError = new JedisBroadcastException(); for (Map.Entry entry : connectionMap.entrySet()) { HostAndPort node = HostAndPort.from(entry.getKey()); ConnectionPool pool = entry.getValue(); try (Connection connection = pool.getResource()) { - try { - T aReply = execute(connection, commandObject); - holder.addReply(node, aReply); - if (isErrored) { // already errored - } else if (reply == null) { - reply = aReply; // ok - } else if (reply.equals(aReply)) { - // ok - } else { - isErrored = true; - reply = null; - } - } catch (JedisDataException anError) { - holder.addError(node, anError); + T aReply = execute(connection, commandObject); + bcastError.addReply(node, aReply); + if (isErrored) { // already errored + } else if (reply == null) { + reply = aReply; // ok + } else if (reply.equals(aReply)) { + // ok + } else { + isErrored = true; + reply = null; } + } catch (Exception anError) { + bcastError.addReply(node, anError); + isErrored = true; } } if (isErrored) { - throw holder; + throw bcastError; } return reply; } diff --git a/src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java b/src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java new file mode 100644 index 0000000000..f5adb42c9e --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java @@ -0,0 +1,26 @@ +package redis.clients.jedis.gears; + +import redis.clients.jedis.gears.resps.GearsLibraryInfo; + +import java.util.List; + +public interface RedisGearsCommands { + + default String tFunctionLoad(String libraryCode) { + return tFunctionLoad(libraryCode, TFunctionLoadParams.loadParams()); + } + + String tFunctionLoad(String libraryCode, TFunctionLoadParams params); + + default List tFunctionList() { + return tFunctionList(TFunctionListParams.listParams()); + } + + List tFunctionList(TFunctionListParams params); + + String tFunctionDelete(String libraryName); + + Object tFunctionCall(String library, String function, List keys, List args); + + Object tFunctionCallAsync(String library, String function, List keys, List args); +} diff --git a/src/main/java/redis/clients/jedis/gears/RedisGearsProtocol.java b/src/main/java/redis/clients/jedis/gears/RedisGearsProtocol.java new file mode 100644 index 0000000000..fc43f29e66 --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/RedisGearsProtocol.java @@ -0,0 +1,49 @@ +package redis.clients.jedis.gears; + +import redis.clients.jedis.args.Rawable; +import redis.clients.jedis.commands.ProtocolCommand; +import redis.clients.jedis.util.SafeEncoder; + +public class RedisGearsProtocol { + + public enum GearsCommand implements ProtocolCommand { + + TFUNCTION, + TFCALL, + TFCALLASYNC; + + private final byte[] raw; + + private GearsCommand() { + this.raw = SafeEncoder.encode(name()); + } + + @Override + public byte[] getRaw() { + return raw; + } + } + + public enum GearsKeyword implements Rawable { + + CONFIG, + REPLACE, + LOAD, + DELETE, + LIST, + WITHCODE, + LIBRARY, + VERBOSE; + + private final byte[] raw; + + private GearsKeyword() { + this.raw = SafeEncoder.encode(name()); + } + + @Override + public byte[] getRaw() { + return raw; + } + } +} diff --git a/src/main/java/redis/clients/jedis/gears/TFunctionListParams.java b/src/main/java/redis/clients/jedis/gears/TFunctionListParams.java new file mode 100644 index 0000000000..d3f867e92b --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/TFunctionListParams.java @@ -0,0 +1,49 @@ +package redis.clients.jedis.gears; + +import redis.clients.jedis.CommandArguments; +import redis.clients.jedis.gears.RedisGearsProtocol.GearsKeyword; +import redis.clients.jedis.params.IParams; + +import java.util.Collections; + +public class TFunctionListParams implements IParams { + private boolean withCode = false; + private int verbose; + private String libraryName; + + public static TFunctionListParams listParams() { + return new TFunctionListParams(); + } + + @Override + public void addParams(CommandArguments args) { + if (withCode) { + args.add(GearsKeyword.WITHCODE); + } + + if (verbose > 0 && verbose < 4) { + args.add(String.join("", Collections.nCopies(verbose, "v"))); + } else if (verbose != 0) { // verbose == 0 is the default, so we don't need to throw an error + throw new IllegalArgumentException("verbose must be between 1 and 3"); + } + + if (libraryName != null) { + args.add(GearsKeyword.LIBRARY).add(libraryName); + } + } + + public TFunctionListParams withCode() { + this.withCode = true; + return this; + } + + public TFunctionListParams verbose(int verbose) { + this.verbose = verbose; + return this; + } + + public TFunctionListParams library(String libraryName) { + this.libraryName = libraryName; + return this; + } +} diff --git a/src/main/java/redis/clients/jedis/gears/TFunctionLoadParams.java b/src/main/java/redis/clients/jedis/gears/TFunctionLoadParams.java new file mode 100644 index 0000000000..d155727ec5 --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/TFunctionLoadParams.java @@ -0,0 +1,35 @@ +package redis.clients.jedis.gears; + +import redis.clients.jedis.CommandArguments; +import redis.clients.jedis.gears.RedisGearsProtocol.GearsKeyword; +import redis.clients.jedis.params.IParams; + +public class TFunctionLoadParams implements IParams { + private boolean replace = false; + private String config; + + public static TFunctionLoadParams loadParams() { + return new TFunctionLoadParams(); + } + + @Override + public void addParams(CommandArguments args) { + if (replace) { + args.add(GearsKeyword.REPLACE); + } + + if (config != null && !config.isEmpty()) { + args.add(GearsKeyword.CONFIG).add(config); + } + } + + public TFunctionLoadParams replace() { + this.replace = true; + return this; + } + + public TFunctionLoadParams config(String config) { + this.config = config; + return this; + } +} diff --git a/src/main/java/redis/clients/jedis/gears/resps/FunctionInfo.java b/src/main/java/redis/clients/jedis/gears/resps/FunctionInfo.java new file mode 100644 index 0000000000..ccb8785812 --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/resps/FunctionInfo.java @@ -0,0 +1,97 @@ +package redis.clients.jedis.gears.resps; + +import redis.clients.jedis.Builder; +import redis.clients.jedis.util.KeyValue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static redis.clients.jedis.BuilderFactory.*; + +public class FunctionInfo { + private final String name; + private final String description; + private final boolean isAsync; + + private final List flags; + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public boolean isAsync() { + return isAsync; + } + + public List getFlags() { + return flags; + } + + public FunctionInfo(String name, String description, boolean isAsync, List flags) { + this.name = name; + this.description = description; + this.isAsync = isAsync; + this.flags = flags; + } + + public static final Builder> FUNCTION_INFO_LIST = new Builder>() { + @Override + public List build(Object data) { + List dataAsList = (List) data; + if (!dataAsList.isEmpty()) { + boolean isListOfList = dataAsList.get(0).getClass().isAssignableFrom(ArrayList.class); + + if (isListOfList) { + if (((List>)data).get(0).get(0) instanceof KeyValue) { + List> dataAsKeyValues = (List>)data; + return dataAsKeyValues.stream().map(keyValues -> { + String name = null; + String description = null; + List flags = Collections.emptyList(); + boolean isAsync = false; + for (KeyValue kv : keyValues) { + switch (STRING.build(kv.getKey())) { + case "name": + name = STRING.build(kv.getValue()); + break; + case "description": + description = STRING.build(kv.getValue()); + break; + case "raw-arguments": + flags = STRING_LIST.build(kv.getValue()); + break; + case "is_async": + isAsync = BOOLEAN.build(kv.getValue()); + break; + } + } + return new FunctionInfo(name, description, isAsync, flags); + }).collect(Collectors.toList()); + } else { + return dataAsList.stream().map((pairObject) -> (List) pairObject) + .map((pairList) -> new FunctionInfo( // + STRING.build(pairList.get(7)), // name + STRING.build(pairList.get(1)), // description + BOOLEAN.build(pairList.get(5)), // is_async + STRING_LIST.build(pairList.get(3)) // flags + )).collect(Collectors.toList()); + } + } else { + return dataAsList.stream() // + .map(STRING::build) // + .map((name) -> new FunctionInfo(name, null, false, null)) // + .collect(Collectors.toList()); + } + } else { + return Collections.emptyList(); + } + } + }; +} + diff --git a/src/main/java/redis/clients/jedis/gears/resps/FunctionStreamInfo.java b/src/main/java/redis/clients/jedis/gears/resps/FunctionStreamInfo.java new file mode 100644 index 0000000000..f4b607d6a3 --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/resps/FunctionStreamInfo.java @@ -0,0 +1,88 @@ +package redis.clients.jedis.gears.resps; + +import redis.clients.jedis.Builder; +import redis.clients.jedis.BuilderFactory; + +import java.util.List; +import java.util.stream.Collectors; + +public class FunctionStreamInfo { + private final String name; + private final String idToReadFrom; + private final String lastError; + private final long lastLag; + private final long lastProcessedTime; + private final long totalLag; + private final long totalProcessedTime; + private final long totalRecordProcessed; + private final List pendingIds; + + public String getName() { + return name; + } + + public String getIdToReadFrom() { + return idToReadFrom; + } + + public String getLastError() { + return lastError; + } + + public long getLastLag() { + return lastLag; + } + + public long getLastProcessedTime() { + return lastProcessedTime; + } + + public long getTotalLag() { + return totalLag; + } + + public long getTotalProcessedTime() { + return totalProcessedTime; + } + + public long getTotalRecordProcessed() { + return totalRecordProcessed; + } + + public List getPendingIds() { + return pendingIds; + } + + public FunctionStreamInfo(String name, String idToReadFrom, String lastError, + long lastProcessedTime, long lastLag, long totalLag, long totalProcessedTime, long totalRecordProcessed, + List pendingIds) { + this.name = name; + this.idToReadFrom = idToReadFrom; + this.lastError = lastError; + this.lastProcessedTime = lastProcessedTime; + this.lastLag = lastLag; + this.totalLag = totalLag; + this.totalProcessedTime = totalProcessedTime; + this.totalRecordProcessed = totalRecordProcessed; + this.pendingIds = pendingIds; + } + + public static final Builder> STREAM_INFO_LIST = new Builder>() { + @Override + public List build(Object data) { + return ((List) data).stream().map((pairObject) -> (List) pairObject) + .map((pairList) -> new FunctionStreamInfo( + BuilderFactory.STRING.build(pairList.get(9)), // name + BuilderFactory.STRING.build(pairList.get(1)), // id_to_read_from + BuilderFactory.STRING.build(pairList.get(3)), // last_error + BuilderFactory.LONG.build(pairList.get(7)), // last_processed_time + BuilderFactory.LONG.build(pairList.get(5)), // last_lag + BuilderFactory.LONG.build(pairList.get(13)), // total_lag + BuilderFactory.LONG.build(pairList.get(15)), // total_processed_time + BuilderFactory.LONG.build(pairList.get(17)), // total_record_processed + BuilderFactory.STRING_LIST.build(pairList.get(11)) // pending_ids + ))// + .collect(Collectors.toList()); + } + }; +} diff --git a/src/main/java/redis/clients/jedis/gears/resps/GearsLibraryInfo.java b/src/main/java/redis/clients/jedis/gears/resps/GearsLibraryInfo.java new file mode 100644 index 0000000000..5ed6515ff6 --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/resps/GearsLibraryInfo.java @@ -0,0 +1,182 @@ +package redis.clients.jedis.gears.resps; + +import redis.clients.jedis.Builder; +import redis.clients.jedis.util.KeyValue; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static redis.clients.jedis.BuilderFactory.*; +import static redis.clients.jedis.gears.resps.FunctionInfo.FUNCTION_INFO_LIST; +import static redis.clients.jedis.gears.resps.StreamTriggerInfo.STREAM_TRIGGER_INFO_LIST; +import static redis.clients.jedis.gears.resps.TriggerInfo.KEYSPACE_TRIGGER_INFO_LIST; + +public class GearsLibraryInfo { + private final String apiVersion; + private final List clusterFunctions; + private final String code; + private final String configuration; + private final String engine; + private final List functions; + private final List keyspaceTriggers; + private final String name; + private final List pendingAsyncCalls; + private final long pendingJobs; + private final List streamTriggers; + private final String user; + + public GearsLibraryInfo(String apiVersion, List clusterFunctions, String code, String configuration, + String engine, List functions, List keyspaceTriggers, String name, + List pendingAsyncCalls, long pendingJobs, List streamTriggers, String user) { + this.apiVersion = apiVersion; + this.clusterFunctions = clusterFunctions; + this.code = code; + this.configuration = configuration; + this.engine = engine; + this.functions = functions; + this.keyspaceTriggers = keyspaceTriggers; + this.name = name; + this.pendingAsyncCalls = pendingAsyncCalls; + this.pendingJobs = pendingJobs; + this.streamTriggers = streamTriggers; + this.user = user; + } + public String getApiVersion() { + return apiVersion; + } + + public List getClusterFunctions() { + return clusterFunctions; + } + + public String getCode() { + return code; + } + + public String getConfiguration() { + return configuration; + } + + public String getEngine() { + return engine; + } + + public List getFunctions() { + return functions; + } + + public List getKeyspaceTriggers() { + return keyspaceTriggers; + } + + public String getName() { + return name; + } + + public List getPendingAsyncCalls() { + return pendingAsyncCalls; + } + + public long getPendingJobs() { + return pendingJobs; + } + + public List getStreamTriggers() { + return streamTriggers; + } + + public String getUser() { + return user; + } + + public static final Builder GEARS_LIBRARY_INFO = new Builder() { + @Override + public GearsLibraryInfo build(Object data) { + if (data == null) return null; + List list = (List) data; + if (list.isEmpty()) return null; + + String apiVersion = null; + List clusterFunctions = Collections.emptyList(); + String code = null; + String configuration = null; + String engine = null; + List functions = Collections.emptyList(); + List keyspaceTriggers = Collections.emptyList(); + String name = null; + List pendingAsyncCalls = null; + long pendingJobs = 0; + List streamTriggers = Collections.emptyList(); + String user = null; + + if (list.get(0) instanceof KeyValue) { + for (KeyValue kv : (List) list) { + switch (STRING.build(kv.getKey())) { + case "api_version": + apiVersion = STRING.build(kv.getValue()); + break; + case "cluster_functions": + clusterFunctions = STRING_LIST.build(kv.getValue()); + break; + case "configuration": + configuration = STRING.build(kv.getValue()); + break; + case "engine": + engine = STRING.build(kv.getValue()); + break; + case "functions": + functions = FUNCTION_INFO_LIST.build(kv.getValue()); + break; + case "keyspace_triggers": + keyspaceTriggers = KEYSPACE_TRIGGER_INFO_LIST.build(kv.getValue()); + break; + case "name": + name = STRING.build(kv.getValue()); + break; + case "pending_async_calls": + pendingAsyncCalls = STRING_LIST.build(kv.getValue()); + break; + case "pending_jobs": + pendingJobs = LONG.build(kv.getValue()); + break; + case "stream_triggers": + streamTriggers = STREAM_TRIGGER_INFO_LIST.build(kv.getValue()); + break; + case "user": + user = STRING.build(kv.getValue()); + break; + case "code": + code = STRING.build(kv.getValue()); + break; + } + } + } else { + boolean withCode = list.size() > 23; + int offset = withCode ? 2 : 0; + apiVersion = STRING.build(list.get(1)); + clusterFunctions = STRING_LIST.build(list.get(3)); + code = withCode ? STRING.build(list.get(5)) : null; + configuration = STRING.build(list.get(5 + offset)); + engine = STRING.build(list.get(7 + offset)); + functions = FUNCTION_INFO_LIST.build(list.get(9 + offset)); + keyspaceTriggers = KEYSPACE_TRIGGER_INFO_LIST.build(list.get(11 + offset)); + name = STRING.build(list.get(13 + offset)); + pendingAsyncCalls = STRING_LIST.build(list.get(15 + offset)); + pendingJobs = LONG.build(list.get(17 + offset)); + streamTriggers = STREAM_TRIGGER_INFO_LIST.build(list.get(19 + offset)); + user = STRING.build(list.get(21 + offset)); + } + return new GearsLibraryInfo(apiVersion, clusterFunctions, code, configuration, engine, functions, keyspaceTriggers, name, pendingAsyncCalls, pendingJobs, streamTriggers, user); + } + }; + + public static final Builder> GEARS_LIBRARY_INFO_LIST = new Builder>() { + @Override + public List build(Object data) { + List list = (List) data; + return list.stream().map(o -> GearsLibraryInfo.GEARS_LIBRARY_INFO.build(o)).collect(Collectors.toList()); + } + }; + +} \ No newline at end of file diff --git a/src/main/java/redis/clients/jedis/gears/resps/StreamTriggerInfo.java b/src/main/java/redis/clients/jedis/gears/resps/StreamTriggerInfo.java new file mode 100644 index 0000000000..be526e0e71 --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/resps/StreamTriggerInfo.java @@ -0,0 +1,145 @@ +package redis.clients.jedis.gears.resps; + +import redis.clients.jedis.Builder; +import redis.clients.jedis.util.KeyValue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static redis.clients.jedis.BuilderFactory.*; +import static redis.clients.jedis.gears.resps.FunctionStreamInfo.STREAM_INFO_LIST; + +public class StreamTriggerInfo { + private final String name; + private final String description; + private final String prefix; + private final boolean trim; + private final long window; + private final List streams; + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getPrefix() { + return prefix; + } + public boolean isTrim() { + return trim; + } + + public long getWindow() { + return window; + } + + public List getStreams() { + return streams; + } + + public StreamTriggerInfo(String name, String description, String prefix, + long window, boolean trim, List streams) { + this.name = name; + this.description = description; + this.prefix = prefix; + this.window = window; + this.trim = trim; + this.streams = streams; + } + public StreamTriggerInfo(String name) { + this(name, null, null, 0, false, Collections.emptyList()); + } + + public StreamTriggerInfo(String name, String description, String prefix, + long window, boolean trim) { + this(name, description, prefix, window, trim, Collections.emptyList()); + } + + public static final Builder> STREAM_TRIGGER_INFO_LIST = new Builder>() { + @Override + public List build(Object data) { + List dataAsList = (List) data; + if (!dataAsList.isEmpty()) { + boolean isListOfList = dataAsList.get(0).getClass().isAssignableFrom(ArrayList.class); + if (isListOfList) { + if (((List>)data).get(0).get(0) instanceof KeyValue) { + List> dataAsKeyValues = (List>)data; + return dataAsKeyValues.stream().map(keyValues -> { + String name = null; + String description = null; + String prefix = null; + long window = 0; + boolean trim = false; + List streams = null; + + for (KeyValue kv : keyValues) { + switch (STRING.build(kv.getKey())) { + case "name": + name = STRING.build(kv.getValue()); + break; + case "description": + description = STRING.build(kv.getValue()); + break; + case "prefix": + prefix = STRING.build(kv.getValue()); + break; + case "window": + window = LONG.build(kv.getValue()); + break; + case "trim": + trim = BOOLEAN.build(kv.getValue()); + break; + case "streams": + streams = STREAM_INFO_LIST.build(kv.getValue()); + break; + } + } + return new StreamTriggerInfo(name, description, prefix, window, trim, streams); + }).collect(Collectors.toList()); + } else { + return dataAsList.stream().map((pairObject) -> (List) pairObject).map((pairList) -> { + StreamTriggerInfo result = null; + switch (pairList.size()) { + case 1: + result = new StreamTriggerInfo(STRING.build(pairList.get(0))); + break; + case 10: + result = new StreamTriggerInfo( // + STRING.build(pairList.get(3)), // name + STRING.build(pairList.get(1)), // description + STRING.build(pairList.get(5)), // prefix + LONG.build(pairList.get(9)), // window + BOOLEAN.build(pairList.get(7)) // trim + ); + break; + case 12: + result = new StreamTriggerInfo( // + STRING.build(pairList.get(3)), // name + STRING.build(pairList.get(1)), // description + STRING.build(pairList.get(5)), // prefix + LONG.build(pairList.get(11)), // window + BOOLEAN.build(pairList.get(9)), // trim + STREAM_INFO_LIST.build(pairList.get(7)) // streams + ); + break; + } + return result; + }) // + .collect(Collectors.toList()); + } + } else { + return dataAsList.stream() // + .map(STRING::build).map((name) -> new StreamTriggerInfo(name, null, null, 0, false)) // + .collect(Collectors.toList()); + } + } else { + return Collections.emptyList(); + } + } + }; +} diff --git a/src/main/java/redis/clients/jedis/gears/resps/TriggerInfo.java b/src/main/java/redis/clients/jedis/gears/resps/TriggerInfo.java new file mode 100644 index 0000000000..8a5b470484 --- /dev/null +++ b/src/main/java/redis/clients/jedis/gears/resps/TriggerInfo.java @@ -0,0 +1,162 @@ +package redis.clients.jedis.gears.resps; + +import redis.clients.jedis.Builder; +import redis.clients.jedis.util.KeyValue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static redis.clients.jedis.BuilderFactory.LONG; +import static redis.clients.jedis.BuilderFactory.STRING; + +public class TriggerInfo { + private final String name; + private final String description; + + private final String lastError; + + private final long lastExecutionTime; + + private final long numFailed; + + private final long numFinished; + + private final long numSuccess; + + private final long numTrigger; + + private final long totalExecutionTime; + + + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getLastError() { + return lastError; + } + + public long getLastExecutionTime() { + return lastExecutionTime; + } + + public long getNumFailed() { + return numFailed; + } + + public long getNumFinished() { + return numFinished; + } + + public long getNumSuccess() { + return numSuccess; + } + + public long getNumTrigger() { + return numTrigger; + } + + public long getTotalExecutionTime() { + return totalExecutionTime; + } + + public TriggerInfo(String name, String description, String lastError, long numFinished, long numSuccess, + long numFailed, long numTrigger, long lastExecutionTime, long totalExecutionTime) { + this.name = name; + this.description = description; + this.lastError = lastError; + this.numFinished = numFinished; + this.numSuccess = numSuccess; + this.numFailed = numFailed; + this.numTrigger = numTrigger; + this.lastExecutionTime = lastExecutionTime; + this.totalExecutionTime = totalExecutionTime; + } + + public static final Builder> KEYSPACE_TRIGGER_INFO_LIST = new Builder>() { + @Override + public List build(Object data) { + List dataAsList = (List) data; + if (!dataAsList.isEmpty()) { + boolean isListOfList = dataAsList.get(0).getClass().isAssignableFrom(ArrayList.class); + if (isListOfList) { + if (((List>)data).get(0).get(0) instanceof KeyValue) { + List> dataAsKeyValues = (List>)data; + return dataAsKeyValues.stream().map(keyValues -> { + String name = null; + String description = null; + String lastError = null; + long lastExecutionTime = 0; + long numFailed = 0; + long numFinished = 0; + long numSuccess = 0; + long numTrigger = 0; + long totalExecutionTime = 0; + + for (KeyValue kv : keyValues) { + switch (STRING.build(kv.getKey())) { + case "name": + name = STRING.build(kv.getValue()); + break; + case "description": + description = STRING.build(kv.getValue()); + break; + case "last_error": + lastError = STRING.build(kv.getValue()); + break; + case "last_execution_time": + lastExecutionTime = LONG.build(kv.getValue()); + break; + case "num_failed": + numFailed = LONG.build(kv.getValue()); + break; + case "num_finished": + numFinished = LONG.build(kv.getValue()); + break; + case "num_success": + numSuccess = LONG.build(kv.getValue()); + break; + case "num_trigger": + numTrigger = LONG.build(kv.getValue()); + break; + case "total_execution_time": + totalExecutionTime = LONG.build(kv.getValue()); + break; + } + } + return new TriggerInfo(name, description, lastError, numFinished, numSuccess, numFailed, numTrigger, + lastExecutionTime, totalExecutionTime); + }).collect(Collectors.toList()); + } else { + return dataAsList.stream().map((pairObject) -> (List) pairObject) + .map((pairList) -> new TriggerInfo(STRING.build(pairList.get(7)), // name + STRING.build(pairList.get(1)), // description + STRING.build(pairList.get(3)), // last_error + LONG.build(pairList.get(11)), // num_finished + LONG.build(pairList.get(13)), // num_success + LONG.build(pairList.get(9)), // num_failed + LONG.build(pairList.get(15)), // num_trigger + LONG.build(pairList.get(5)), // last_execution_time + LONG.build(pairList.get(17)) // total_execution_time + ))// + .collect(Collectors.toList()); + } + } else { + return dataAsList.stream() // + .map(STRING::build)// + .map((name) -> new TriggerInfo(name, null, null, 0,0,0,0,0,0)) // + .collect(Collectors.toList()); + } + } else { + return Collections.emptyList(); + } + } + }; +} diff --git a/src/main/java/redis/clients/jedis/graph/GraphCache.java b/src/main/java/redis/clients/jedis/graph/GraphCache.java index 5ee78def0b..e168e3ee4c 100644 --- a/src/main/java/redis/clients/jedis/graph/GraphCache.java +++ b/src/main/java/redis/clients/jedis/graph/GraphCache.java @@ -3,7 +3,9 @@ /** * Store a local cache in the client, for a specific graph. Holds the labels, property names and * relationship types. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated interface GraphCache { /** diff --git a/src/main/java/redis/clients/jedis/graph/GraphCommandObjects.java b/src/main/java/redis/clients/jedis/graph/GraphCommandObjects.java index 905f4bb24d..a9a49c9081 100644 --- a/src/main/java/redis/clients/jedis/graph/GraphCommandObjects.java +++ b/src/main/java/redis/clients/jedis/graph/GraphCommandObjects.java @@ -19,6 +19,10 @@ import redis.clients.jedis.graph.GraphProtocol.GraphCommand; import redis.clients.jedis.providers.ConnectionProvider; +/** + * @deprecated Redis Graph support is deprecated. + */ +@Deprecated public class GraphCommandObjects { private final RedisGraphCommands graph; diff --git a/src/main/java/redis/clients/jedis/graph/GraphProtocol.java b/src/main/java/redis/clients/jedis/graph/GraphProtocol.java index 0e06eb0bc8..6884466c10 100644 --- a/src/main/java/redis/clients/jedis/graph/GraphProtocol.java +++ b/src/main/java/redis/clients/jedis/graph/GraphProtocol.java @@ -4,8 +4,10 @@ import redis.clients.jedis.commands.ProtocolCommand; import redis.clients.jedis.util.SafeEncoder; +@Deprecated public class GraphProtocol { + @Deprecated public enum GraphCommand implements ProtocolCommand { QUERY, @@ -29,6 +31,7 @@ public byte[] getRaw() { } } + @Deprecated public enum GraphKeyword implements Rawable { CYPHER, diff --git a/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java b/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java index 82738d2485..f670c1e5c1 100644 --- a/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java +++ b/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java @@ -2,15 +2,16 @@ import java.util.HashMap; import java.util.Map; -import java.util.function.Function; import redis.clients.jedis.CommandArguments; -import redis.clients.jedis.commands.ProtocolCommand; import redis.clients.jedis.exceptions.JedisException; -import redis.clients.jedis.graph.GraphProtocol.GraphCommand; import redis.clients.jedis.graph.GraphProtocol.GraphKeyword; import redis.clients.jedis.params.IParams; +/** + * @deprecated Redis Graph support is deprecated. + */ +@Deprecated public class GraphQueryParams implements IParams { private boolean readonly; diff --git a/src/main/java/redis/clients/jedis/graph/Header.java b/src/main/java/redis/clients/jedis/graph/Header.java index f69b16df09..a9ed7e0314 100644 --- a/src/main/java/redis/clients/jedis/graph/Header.java +++ b/src/main/java/redis/clients/jedis/graph/Header.java @@ -3,8 +3,10 @@ import java.util.List; /** - * Query response header interface. Represents the response schema (column names and types) + * Query response header interface. Represents the response schema (column names and types). + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public interface Header { List getSchemaTypes(); diff --git a/src/main/java/redis/clients/jedis/graph/Record.java b/src/main/java/redis/clients/jedis/graph/Record.java index 46e6abb58d..9e02fd9849 100644 --- a/src/main/java/redis/clients/jedis/graph/Record.java +++ b/src/main/java/redis/clients/jedis/graph/Record.java @@ -6,7 +6,10 @@ * Container for RedisGraph result values. * * List records are returned from RedisGraph statement execution, contained within a ResultSet. + * + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public interface Record { /** @@ -63,7 +66,7 @@ public interface Record { * * @param key header key * - * @return true if the the key exists + * @return true if the key exists */ boolean containsKey(String key); diff --git a/src/main/java/redis/clients/jedis/graph/RedisGraphCommands.java b/src/main/java/redis/clients/jedis/graph/RedisGraphCommands.java index 07f78b7b8d..45115a7bfa 100644 --- a/src/main/java/redis/clients/jedis/graph/RedisGraphCommands.java +++ b/src/main/java/redis/clients/jedis/graph/RedisGraphCommands.java @@ -3,6 +3,10 @@ import java.util.List; import java.util.Map; +/** + * @deprecated Redis Graph support is deprecated. + */ +@Deprecated public interface RedisGraphCommands { /** @@ -11,7 +15,9 @@ public interface RedisGraphCommands { * @param name a graph to perform the query on * @param query Cypher query * @return a result set + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphQuery(String name, String query); /** @@ -20,7 +26,9 @@ public interface RedisGraphCommands { * @param name a graph to perform the query on * @param query Cypher query * @return a result set + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphReadonlyQuery(String name, String query); /** @@ -30,7 +38,9 @@ public interface RedisGraphCommands { * @param query Cypher query * @param timeout * @return a result set + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphQuery(String name, String query, long timeout); /** @@ -40,7 +50,9 @@ public interface RedisGraphCommands { * @param query Cypher query * @param timeout * @return a result set + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphReadonlyQuery(String name, String query, long timeout); /** @@ -50,7 +62,9 @@ public interface RedisGraphCommands { * @param query Cypher query. * @param params parameters map. * @return a result set. + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphQuery(String name, String query, Map params); /** @@ -60,7 +74,9 @@ public interface RedisGraphCommands { * @param query Cypher query. * @param params parameters map. * @return a result set. + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphReadonlyQuery(String name, String query, Map params); /** @@ -71,7 +87,9 @@ public interface RedisGraphCommands { * @param params parameters map. * @param timeout * @return a result set. + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphQuery(String name, String query, Map params, long timeout); /** @@ -82,7 +100,9 @@ public interface RedisGraphCommands { * @param params parameters map. * @param timeout * @return a result set. + * @deprecated Redis Graph support is deprecated. */ + @Deprecated ResultSet graphReadonlyQuery(String name, String query, Map params, long timeout); /** @@ -90,32 +110,44 @@ public interface RedisGraphCommands { * * @param name graph to delete * @return delete running time statistics + * @deprecated Redis Graph support is deprecated. */ + @Deprecated String graphDelete(String name); /** * Lists all graph keys in the keyspace. * @return graph keys + * @deprecated Redis Graph support is deprecated. */ + @Deprecated List graphList(); /** * Executes a query and produces an execution plan augmented with metrics for each operation's execution. + * @deprecated Redis Graph support is deprecated. */ + @Deprecated List graphProfile(String graphName, String query); /** * Constructs a query execution plan but does not run it. Inspect this execution plan to better understand how your * query will get executed. + * @deprecated Redis Graph support is deprecated. */ + @Deprecated List graphExplain(String graphName, String query); /** * Returns a list containing up to 10 of the slowest queries issued against the given graph ID. + * @deprecated Redis Graph support is deprecated. */ + @Deprecated List> graphSlowlog(String graphName); + @Deprecated String graphConfigSet(String configName, Object value); + @Deprecated Map graphConfigGet(String configName); } diff --git a/src/main/java/redis/clients/jedis/graph/RedisGraphPipelineCommands.java b/src/main/java/redis/clients/jedis/graph/RedisGraphPipelineCommands.java index ecc97a6c8f..b270fc79c8 100644 --- a/src/main/java/redis/clients/jedis/graph/RedisGraphPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/graph/RedisGraphPipelineCommands.java @@ -4,25 +4,39 @@ import java.util.Map; import redis.clients.jedis.Response; +/** + * @deprecated Redis Graph support is deprecated. + */ +@Deprecated public interface RedisGraphPipelineCommands { + @Deprecated Response graphQuery(String name, String query); + @Deprecated Response graphReadonlyQuery(String name, String query); + @Deprecated Response graphQuery(String name, String query, long timeout); + @Deprecated Response graphReadonlyQuery(String name, String query, long timeout); + @Deprecated Response graphQuery(String name, String query, Map params); + @Deprecated Response graphReadonlyQuery(String name, String query, Map params); + @Deprecated Response graphQuery(String name, String query, Map params, long timeout); + @Deprecated Response graphReadonlyQuery(String name, String query, Map params, long timeout); + @Deprecated Response graphDelete(String name); + @Deprecated Response> graphProfile(String graphName, String query); } diff --git a/src/main/java/redis/clients/jedis/graph/RedisGraphQueryUtil.java b/src/main/java/redis/clients/jedis/graph/RedisGraphQueryUtil.java index a98cb49745..d762dc47f6 100644 --- a/src/main/java/redis/clients/jedis/graph/RedisGraphQueryUtil.java +++ b/src/main/java/redis/clients/jedis/graph/RedisGraphQueryUtil.java @@ -6,6 +6,10 @@ import java.util.Map; import java.util.stream.Collectors; +/** + * @deprecated Redis Graph support is deprecated. + */ +@Deprecated public class RedisGraphQueryUtil { public static final List DUMMY_LIST = Collections.emptyList(); @@ -22,7 +26,9 @@ private RedisGraphQueryUtil() { * @param query - query * @param params - query parameters * @return query with parameters header + * @deprecated Redis Graph support is deprecated. */ + @Deprecated public static String prepareQuery(String query, Map params) { StringBuilder sb = new StringBuilder("CYPHER "); for (Map.Entry entry : params.entrySet()) { diff --git a/src/main/java/redis/clients/jedis/graph/ResultSet.java b/src/main/java/redis/clients/jedis/graph/ResultSet.java index da0a5bcce1..795afa207a 100644 --- a/src/main/java/redis/clients/jedis/graph/ResultSet.java +++ b/src/main/java/redis/clients/jedis/graph/ResultSet.java @@ -1,8 +1,10 @@ package redis.clients.jedis.graph; /** - * Hold a query result + * Hold a query result. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public interface ResultSet extends Iterable { public enum ColumnType { diff --git a/src/main/java/redis/clients/jedis/graph/ResultSetBuilder.java b/src/main/java/redis/clients/jedis/graph/ResultSetBuilder.java index 55839d74c1..9269331cb4 100644 --- a/src/main/java/redis/clients/jedis/graph/ResultSetBuilder.java +++ b/src/main/java/redis/clients/jedis/graph/ResultSetBuilder.java @@ -17,6 +17,10 @@ import redis.clients.jedis.graph.entities.*; import redis.clients.jedis.util.SafeEncoder; +/** + * @deprecated Redis Graph support is deprecated. + */ +@Deprecated class ResultSetBuilder extends Builder { private final GraphCache graphCache; @@ -334,7 +338,7 @@ private static enum ScalarType { UNKNOWN, NULL, STRING, - INTEGER, // 64 bit long. + INTEGER, // 64-bit long. BOOLEAN, DOUBLE, ARRAY, diff --git a/src/main/java/redis/clients/jedis/graph/Statistics.java b/src/main/java/redis/clients/jedis/graph/Statistics.java index f6ad5240f9..332e426bfc 100644 --- a/src/main/java/redis/clients/jedis/graph/Statistics.java +++ b/src/main/java/redis/clients/jedis/graph/Statistics.java @@ -1,5 +1,9 @@ package redis.clients.jedis.graph; +/** + * @deprecated Redis Graph support is deprecated. + */ +@Deprecated public interface Statistics { int nodesCreated(); diff --git a/src/main/java/redis/clients/jedis/graph/entities/Edge.java b/src/main/java/redis/clients/jedis/graph/entities/Edge.java index c02d810000..9595ee8168 100644 --- a/src/main/java/redis/clients/jedis/graph/entities/Edge.java +++ b/src/main/java/redis/clients/jedis/graph/entities/Edge.java @@ -3,9 +3,11 @@ import java.util.Objects; /** - * A class represent an edge (graph entity). In addition to the base class id and properties, an edge shows its source, - * destination and relationship type + * A class represent an edge (graph entity). In addition to the base class id and properties, an + * edge shows its source, destination and relationship type. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public class Edge extends GraphEntity { //members diff --git a/src/main/java/redis/clients/jedis/graph/entities/GraphEntity.java b/src/main/java/redis/clients/jedis/graph/entities/GraphEntity.java index e075a670d3..8a6b40ad36 100644 --- a/src/main/java/redis/clients/jedis/graph/entities/GraphEntity.java +++ b/src/main/java/redis/clients/jedis/graph/entities/GraphEntity.java @@ -5,7 +5,9 @@ /** * This is an abstract class for representing a graph entity. A graph entity has an id and a set of * properties. The properties are mapped and accessed by their names. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public abstract class GraphEntity { protected long id; diff --git a/src/main/java/redis/clients/jedis/graph/entities/Node.java b/src/main/java/redis/clients/jedis/graph/entities/Node.java index 68e6015f4c..7265c8202c 100644 --- a/src/main/java/redis/clients/jedis/graph/entities/Node.java +++ b/src/main/java/redis/clients/jedis/graph/entities/Node.java @@ -6,7 +6,9 @@ /** * * A class represent an node (graph entity). In addition to the base class id and properties, a node has labels. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public class Node extends GraphEntity { //members diff --git a/src/main/java/redis/clients/jedis/graph/entities/Path.java b/src/main/java/redis/clients/jedis/graph/entities/Path.java index ff6471a3db..2efecb309f 100644 --- a/src/main/java/redis/clients/jedis/graph/entities/Path.java +++ b/src/main/java/redis/clients/jedis/graph/entities/Path.java @@ -5,7 +5,9 @@ /** * This class represents a path in the graph. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public final class Path { private final List nodes; diff --git a/src/main/java/redis/clients/jedis/graph/entities/Point.java b/src/main/java/redis/clients/jedis/graph/entities/Point.java index 552d141c52..a5edd513c4 100644 --- a/src/main/java/redis/clients/jedis/graph/entities/Point.java +++ b/src/main/java/redis/clients/jedis/graph/entities/Point.java @@ -5,7 +5,9 @@ /** * This class represents a (geographical) point in the graph. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public final class Point { private static final double EPSILON = 1e-5; diff --git a/src/main/java/redis/clients/jedis/graph/entities/Property.java b/src/main/java/redis/clients/jedis/graph/entities/Property.java index cb02899cd1..1f23ad978f 100644 --- a/src/main/java/redis/clients/jedis/graph/entities/Property.java +++ b/src/main/java/redis/clients/jedis/graph/entities/Property.java @@ -4,7 +4,9 @@ /** * A Graph entity property. Has a name, type, and value. + * @deprecated Redis Graph support is deprecated. */ +@Deprecated public class Property { private final String name; diff --git a/src/main/java/redis/clients/jedis/json/JsonBuilderFactory.java b/src/main/java/redis/clients/jedis/json/JsonBuilderFactory.java index 8b4ec686bc..e4c00f7045 100644 --- a/src/main/java/redis/clients/jedis/json/JsonBuilderFactory.java +++ b/src/main/java/redis/clients/jedis/json/JsonBuilderFactory.java @@ -9,6 +9,7 @@ import org.json.JSONException; import org.json.JSONObject; import redis.clients.jedis.Builder; +import redis.clients.jedis.BuilderFactory; import redis.clients.jedis.exceptions.JedisException; public final class JsonBuilderFactory { @@ -60,6 +61,21 @@ public List> build(Object data) { } }; + public static final Builder>>> JSON_TYPE_RESPONSE_RESP3 = new Builder>>>() { + @Override + public List>> build(Object data) { + return ((List) data).stream().map(JSON_TYPE_LIST::build).collect(Collectors.toList()); + } + }; + + public static final Builder>> JSON_TYPE_RESPONSE_RESP3_COMPATIBLE = new Builder>>() { + @Override + public List> build(Object data) { + List>> fullReply = JSON_TYPE_RESPONSE_RESP3.build(data); + return fullReply == null ? null : fullReply.get(0); + } + }; + public static final Builder JSON_OBJECT = new Builder() { @Override public Object build(Object data) { @@ -70,7 +86,6 @@ public Object build(Object data) { if (!(data instanceof byte[])) { return data; } - String str = STRING.build(data); if (str.charAt(0) == '{') { try { @@ -103,6 +118,15 @@ public JSONArray build(Object data) { } }; + public static final Builder JSON_ARRAY_OR_DOUBLE_LIST = new Builder() { + @Override + public Object build(Object data) { + if (data == null) return null; + if (data instanceof List) return BuilderFactory.DOUBLE_LIST.build(data); + return JSON_ARRAY.build(data); + } + }; + public static final Builder> JSON_ARRAY_LIST = new Builder>() { @Override public List build(Object data) { diff --git a/src/main/java/redis/clients/jedis/json/Path.java b/src/main/java/redis/clients/jedis/json/Path.java index e361cab2ea..d225626e89 100644 --- a/src/main/java/redis/clients/jedis/json/Path.java +++ b/src/main/java/redis/clients/jedis/json/Path.java @@ -1,8 +1,10 @@ package redis.clients.jedis.json; /** - * Path is a ReJSON path, representing a valid path into an object + * Path is a RedisJSON (v1) path, representing a valid path into an object. + * @deprecated RedisJSON (v1) support is deprecated. */ +@Deprecated public class Path { public static final Path ROOT_PATH = new Path("."); diff --git a/src/main/java/redis/clients/jedis/json/Path2.java b/src/main/java/redis/clients/jedis/json/Path2.java index 28211bb470..27c2698689 100644 --- a/src/main/java/redis/clients/jedis/json/Path2.java +++ b/src/main/java/redis/clients/jedis/json/Path2.java @@ -1,7 +1,7 @@ package redis.clients.jedis.json; /** - * Path is a ReJSON path, representing a valid path into an object + * Path is a RedisJSON v2 path, representing a valid path or a multi-path into an object. */ public class Path2 { diff --git a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1Commands.java b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1Commands.java index 4d2e96fec9..5d7fe0d8e7 100644 --- a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1Commands.java +++ b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1Commands.java @@ -4,101 +4,141 @@ import redis.clients.jedis.json.JsonSetParams; import redis.clients.jedis.json.Path; +/** + * @deprecated RedisJSON (v1) support is deprecated. + */ +@Deprecated public interface RedisJsonV1Commands { + @Deprecated default String jsonSetLegacy(String key, Object pojo) { return jsonSet(key, Path.ROOT_PATH, pojo); } + @Deprecated default String jsonSetLegacy(String key, Object pojo, JsonSetParams params) { return jsonSet(key, Path.ROOT_PATH, pojo, params); } + @Deprecated String jsonSet(String key, Path path, Object pojo); + @Deprecated String jsonSetWithPlainString(String key, Path path, String string); + @Deprecated String jsonSet(String key, Path path, Object pojo, JsonSetParams params); + @Deprecated String jsonMerge(String key, Path path, Object pojo); Object jsonGet(String key); // both ver + @Deprecated T jsonGet(String key, Class clazz); + @Deprecated Object jsonGet(String key, Path... paths); + @Deprecated String jsonGetAsPlainString(String key, Path path); + @Deprecated T jsonGet(String key, Class clazz, Path... paths); + @Deprecated default List jsonMGet(Class clazz, String... keys) { return jsonMGet(Path.ROOT_PATH, clazz, keys); } + @Deprecated List jsonMGet(Path path, Class clazz, String... keys); long jsonDel(String key); // both ver + @Deprecated long jsonDel(String key, Path path); long jsonClear(String key); // no test + @Deprecated long jsonClear(String key, Path path); + @Deprecated String jsonToggle(String key, Path path); + @Deprecated Class jsonType(String key); + @Deprecated Class jsonType(String key, Path path); + @Deprecated long jsonStrAppend(String key, Object string); + @Deprecated long jsonStrAppend(String key, Path path, Object string); + @Deprecated Long jsonStrLen(String key); + @Deprecated Long jsonStrLen(String key, Path path); + @Deprecated double jsonNumIncrBy(String key, Path path, double value); + @Deprecated Long jsonArrAppend(String key, Path path, Object... pojos); + @Deprecated long jsonArrIndex(String key, Path path, Object scalar); + @Deprecated long jsonArrInsert(String key, Path path, int index, Object... pojos); + @Deprecated Object jsonArrPop(String key); + @Deprecated T jsonArrPop(String key, Class clazz); + @Deprecated Object jsonArrPop(String key, Path path); + @Deprecated T jsonArrPop(String key, Class clazz, Path path); + @Deprecated Object jsonArrPop(String key, Path path, int index); + @Deprecated T jsonArrPop(String key, Class clazz, Path path, int index); + @Deprecated Long jsonArrLen(String key); + @Deprecated Long jsonArrLen(String key, Path path); + @Deprecated Long jsonArrTrim(String key, Path path, int start, int stop); + @Deprecated Long jsonObjLen(String key); + @Deprecated Long jsonObjLen(String key, Path path); + @Deprecated List jsonObjKeys(String key); + @Deprecated List jsonObjKeys(String key, Path path); + @Deprecated long jsonDebugMemory(String key); + @Deprecated long jsonDebugMemory(String key, Path path); - - List jsonResp(String key); - - List jsonResp(String key, Path path); } diff --git a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1PipelineCommands.java b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1PipelineCommands.java index 5d0be5bce7..b447a1e508 100644 --- a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1PipelineCommands.java +++ b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV1PipelineCommands.java @@ -5,81 +5,118 @@ import redis.clients.jedis.json.JsonSetParams; import redis.clients.jedis.json.Path; -public interface RedisJsonV1PipelineCommands extends RedisJsonV2PipelineCommands { +/** + * @deprecated RedisJSON (v1) support is deprecated. + */ +@Deprecated +public interface RedisJsonV1PipelineCommands { + @Deprecated default Response jsonSetLegacy(String key, Object pojo) { return jsonSet(key, Path.ROOT_PATH, pojo); } + @Deprecated default Response jsonSetLegacy(String key, Object pojo, JsonSetParams params) { return jsonSet(key, Path.ROOT_PATH, pojo, params); } + @Deprecated Response jsonSet(String key, Path path, Object pojo); + @Deprecated Response jsonSet(String key, Path path, Object pojo, JsonSetParams params); + @Deprecated Response jsonMerge(String key, Path path, Object pojo); Response jsonGet(String key); // both ver + @Deprecated Response jsonGet(String key, Class clazz); + @Deprecated Response jsonGet(String key, Path... paths); + @Deprecated Response jsonGet(String key, Class clazz, Path... paths); + @Deprecated default Response> jsonMGet(Class clazz, String... keys) { return jsonMGet(Path.ROOT_PATH, clazz, keys); } + @Deprecated Response> jsonMGet(Path path, Class clazz, String... keys); Response jsonDel(String key); // both ver + @Deprecated Response jsonDel(String key, Path path); + @Deprecated Response jsonClear(String key); // no test + @Deprecated Response jsonClear(String key, Path path); + @Deprecated Response jsonToggle(String key, Path path); + @Deprecated Response> jsonType(String key); + @Deprecated Response> jsonType(String key, Path path); + @Deprecated Response jsonStrAppend(String key, Object string); + @Deprecated Response jsonStrAppend(String key, Path path, Object string); + @Deprecated Response jsonStrLen(String key); + @Deprecated Response jsonStrLen(String key, Path path); + @Deprecated Response jsonNumIncrBy(String key, Path path, double value); + @Deprecated Response jsonArrAppend(String key, Path path, Object... pojos); + @Deprecated Response jsonArrIndex(String key, Path path, Object scalar); + @Deprecated Response jsonArrInsert(String key, Path path, int index, Object... pojos); + @Deprecated Response jsonArrPop(String key); + @Deprecated Response jsonArrPop(String key, Class clazz); + @Deprecated Response jsonArrPop(String key, Path path); + @Deprecated Response jsonArrPop(String key, Class clazz, Path path); + @Deprecated Response jsonArrPop(String key, Path path, int index); + @Deprecated Response jsonArrPop(String key, Class clazz, Path path, int index); + @Deprecated Response jsonArrLen(String key); + @Deprecated Response jsonArrLen(String key, Path path); + @Deprecated Response jsonArrTrim(String key, Path path, int start, int stop); } diff --git a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2Commands.java b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2Commands.java index 4cdc21c14f..2e5f400650 100644 --- a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2Commands.java +++ b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2Commands.java @@ -59,7 +59,7 @@ default List jsonMGet(String... keys) { List jsonStrLen(String key, Path2 path); - JSONArray jsonNumIncrBy(String key, Path2 path, double value); + Object jsonNumIncrBy(String key, Path2 path, double value); List jsonArrAppend(String key, Path2 path, Object... objects); @@ -86,6 +86,4 @@ default List jsonMGet(String... keys) { List> jsonObjKeys(String key, Path2 path); List jsonDebugMemory(String key, Path2 path); - - List> jsonResp(String key, Path2 path); } diff --git a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2PipelineCommands.java b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2PipelineCommands.java index 40d0542333..c6fbbac6b3 100644 --- a/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2PipelineCommands.java +++ b/src/main/java/redis/clients/jedis/json/commands/RedisJsonV2PipelineCommands.java @@ -60,7 +60,7 @@ default Response> jsonMGet(String... keys) { Response> jsonStrLen(String key, Path2 path); - Response jsonNumIncrBy(String key, Path2 path, double value); + Response jsonNumIncrBy(String key, Path2 path, double value); Response> jsonArrAppend(String key, Path2 path, Object... objects); diff --git a/src/main/java/redis/clients/jedis/mcf/CircuitBreakerCommandExecutor.java b/src/main/java/redis/clients/jedis/mcf/CircuitBreakerCommandExecutor.java new file mode 100644 index 0000000000..7a857174cb --- /dev/null +++ b/src/main/java/redis/clients/jedis/mcf/CircuitBreakerCommandExecutor.java @@ -0,0 +1,61 @@ +package redis.clients.jedis.mcf; + +import io.github.resilience4j.circuitbreaker.CircuitBreaker; +import io.github.resilience4j.decorators.Decorators; +import io.github.resilience4j.decorators.Decorators.DecorateSupplier; + +import redis.clients.jedis.CommandObject; +import redis.clients.jedis.Connection; +import redis.clients.jedis.executors.CommandExecutor; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider.Cluster; + +/** + * @author Allen Terleto (aterleto) + *

+ * CommandExecutor with built-in retry, circuit-breaker, and failover to another cluster/database endpoint. + * With this executor users can seamlessly failover to Disaster Recovery (DR), Backup, and Active-Active cluster(s) + * by using simple configuration which is passed through from Resilience4j - https://resilience4j.readme.io/docs + *

+ */ +public class CircuitBreakerCommandExecutor extends CircuitBreakerFailoverBase implements CommandExecutor { + + public CircuitBreakerCommandExecutor(MultiClusterPooledConnectionProvider provider) { + super(provider); + } + + @Override + public T executeCommand(CommandObject commandObject) { + Cluster cluster = provider.getCluster(); // Pass this by reference for thread safety + + DecorateSupplier supplier = Decorators.ofSupplier(() -> this.handleExecuteCommand(commandObject, cluster)); + + supplier.withRetry(cluster.getRetry()); + supplier.withCircuitBreaker(cluster.getCircuitBreaker()); + supplier.withFallback(defaultCircuitBreakerFallbackException, + e -> this.handleClusterFailover(commandObject, cluster.getCircuitBreaker())); + + return supplier.decorate().get(); + } + + /** + * Functional interface wrapped in retry and circuit breaker logic to handle happy path scenarios + */ + private T handleExecuteCommand(CommandObject commandObject, Cluster cluster) { + try (Connection connection = cluster.getConnection()) { + return connection.executeCommand(commandObject); + } + } + + /** + * Functional interface wrapped in retry and circuit breaker logic to handle open circuit breaker failure scenarios + */ + private T handleClusterFailover(CommandObject commandObject, CircuitBreaker circuitBreaker) { + + clusterFailover(circuitBreaker); + + // Recursive call to the initiating method so the operation can be retried on the next cluster connection + return executeCommand(commandObject); + } + +} \ No newline at end of file diff --git a/src/main/java/redis/clients/jedis/executors/CircuitBreakerCommandExecutor.java b/src/main/java/redis/clients/jedis/mcf/CircuitBreakerFailoverBase.java similarity index 53% rename from src/main/java/redis/clients/jedis/executors/CircuitBreakerCommandExecutor.java rename to src/main/java/redis/clients/jedis/mcf/CircuitBreakerFailoverBase.java index a01a58d98d..2228233849 100644 --- a/src/main/java/redis/clients/jedis/executors/CircuitBreakerCommandExecutor.java +++ b/src/main/java/redis/clients/jedis/mcf/CircuitBreakerFailoverBase.java @@ -1,35 +1,32 @@ -package redis.clients.jedis.executors; +package redis.clients.jedis.mcf; import io.github.resilience4j.circuitbreaker.CallNotPermittedException; import io.github.resilience4j.circuitbreaker.CircuitBreaker; -import io.github.resilience4j.decorators.Decorators; -import io.github.resilience4j.decorators.Decorators.DecorateSupplier; -import redis.clients.jedis.*; -import redis.clients.jedis.exceptions.JedisConnectionException; -import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider; -import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider.Cluster; -import redis.clients.jedis.util.IOUtils; import java.util.Arrays; import java.util.List; +import redis.clients.jedis.exceptions.JedisConnectionException; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider; +import redis.clients.jedis.util.IOUtils; /** * @author Allen Terleto (aterleto) *

- * CommandExecutor with built-in retry, circuit-breaker, and failover to another cluster/database endpoint. - * With this executor users can seamlessly failover to Disaster Recovery (DR), Backup, and Active-Active cluster(s) - * by using simple configuration which is passed through from Resilience4j - https://resilience4j.readme.io/docs + * Base class for CommandExecutor with built-in retry, circuit-breaker, and failover to another cluster/database + * endpoint. With this executor users can seamlessly failover to Disaster Recovery (DR), Backup, and Active-Active + * cluster(s) by using simple configuration which is passed through from + * Resilience4j - https://resilience4j.readme.io/docs *

*/ -public class CircuitBreakerCommandExecutor implements CommandExecutor { +public class CircuitBreakerFailoverBase implements AutoCloseable { - private final static List> circuitBreakerFallbackException = + protected final static List> defaultCircuitBreakerFallbackException = Arrays.asList(CallNotPermittedException.class); - private final MultiClusterPooledConnectionProvider provider; + protected final MultiClusterPooledConnectionProvider provider; - public CircuitBreakerCommandExecutor(MultiClusterPooledConnectionProvider provider) { + public CircuitBreakerFailoverBase(MultiClusterPooledConnectionProvider provider) { this.provider = provider; } @@ -38,33 +35,10 @@ public void close() { IOUtils.closeQuietly(this.provider); } - @Override - public T executeCommand(CommandObject commandObject) { - Cluster cluster = provider.getCluster(); // Pass this by reference for thread safety - - DecorateSupplier supplier = Decorators.ofSupplier(() -> this.handleExecuteCommand(commandObject, cluster)); - - supplier.withRetry(cluster.getRetry()); - supplier.withCircuitBreaker(cluster.getCircuitBreaker()); - supplier.withFallback(circuitBreakerFallbackException, - e -> this.handleClusterFailover(commandObject, cluster.getCircuitBreaker())); - - return supplier.decorate().get(); - } - - /** - * Functional interface wrapped in retry and circuit breaker logic to handle happy path scenarios - */ - private T handleExecuteCommand(CommandObject commandObject, Cluster cluster) { - try (Connection connection = cluster.getConnection()) { - return connection.executeCommand(commandObject); - } - } - /** * Functional interface wrapped in retry and circuit breaker logic to handle open circuit breaker failure scenarios */ - private synchronized T handleClusterFailover(CommandObject commandObject, CircuitBreaker circuitBreaker) { + protected synchronized void clusterFailover(CircuitBreaker circuitBreaker) { // Check state to handle race conditions since incrementActiveMultiClusterIndex() is non-idempotent if (!CircuitBreaker.State.FORCED_OPEN.equals(circuitBreaker.getState())) { @@ -87,9 +61,6 @@ else if (provider.isLastClusterCircuitBreakerForcedOpen()) { "provided with an additional cluster/database endpoint according to its prioritized sequence. " + "If applicable, consider failing back OR restarting with an available cluster/database endpoint"); } - - // Recursive call to the initiating method so the operation can be retried on the next cluster connection - return executeCommand(commandObject); } } \ No newline at end of file diff --git a/src/main/java/redis/clients/jedis/mcf/CircuitBreakerFailoverConnectionProvider.java b/src/main/java/redis/clients/jedis/mcf/CircuitBreakerFailoverConnectionProvider.java new file mode 100644 index 0000000000..dad2c751c8 --- /dev/null +++ b/src/main/java/redis/clients/jedis/mcf/CircuitBreakerFailoverConnectionProvider.java @@ -0,0 +1,55 @@ +package redis.clients.jedis.mcf; + +import io.github.resilience4j.circuitbreaker.CircuitBreaker; +import io.github.resilience4j.decorators.Decorators; +import io.github.resilience4j.decorators.Decorators.DecorateSupplier; + +import redis.clients.jedis.Connection; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider.Cluster; + +/** + * ConnectionProvider with built-in retry, circuit-breaker, and failover to another cluster/database endpoint. + * With this executor users can seamlessly failover to Disaster Recovery (DR), Backup, and Active-Active cluster(s) + * by using simple configuration which is passed through from Resilience4j - https://resilience4j.readme.io/docs + */ +public class CircuitBreakerFailoverConnectionProvider extends CircuitBreakerFailoverBase { + + public CircuitBreakerFailoverConnectionProvider(MultiClusterPooledConnectionProvider provider) { + super(provider); + } + + public Connection getConnection() { + Cluster cluster = provider.getCluster(); // Pass this by reference for thread safety + + DecorateSupplier supplier = Decorators.ofSupplier(() -> this.handleGetConnection(cluster)); + + supplier.withRetry(cluster.getRetry()); + supplier.withCircuitBreaker(cluster.getCircuitBreaker()); + supplier.withFallback(defaultCircuitBreakerFallbackException, + e -> this.handleClusterFailover(cluster.getCircuitBreaker())); + + return supplier.decorate().get(); + } + + /** + * Functional interface wrapped in retry and circuit breaker logic to handle happy path scenarios + */ + private Connection handleGetConnection(Cluster cluster) { + Connection connection = cluster.getConnection(); + connection.ping(); + return connection; + } + + /** + * Functional interface wrapped in retry and circuit breaker logic to handle open circuit breaker failure scenarios + */ + private Connection handleClusterFailover(CircuitBreaker circuitBreaker) { + + clusterFailover(circuitBreaker); + + // Recursive call to the initiating method so the operation can be retried on the next cluster connection + return getConnection(); + } + +} \ No newline at end of file diff --git a/src/main/java/redis/clients/jedis/mcf/MultiClusterPipeline.java b/src/main/java/redis/clients/jedis/mcf/MultiClusterPipeline.java new file mode 100644 index 0000000000..94f686c2d7 --- /dev/null +++ b/src/main/java/redis/clients/jedis/mcf/MultiClusterPipeline.java @@ -0,0 +1,124 @@ +package redis.clients.jedis.mcf; + +import java.io.Closeable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Queue; + +import redis.clients.jedis.*; +import redis.clients.jedis.graph.ResultSet; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider; +import redis.clients.jedis.util.KeyValue; + +/** + * This is high memory dependent solution as all the appending commands will be hold in memory until + * {@link MultiClusterPipeline#sync() SYNC} (or {@link MultiClusterPipeline#close() CLOSE}) gets called. + */ +public class MultiClusterPipeline extends PipelineBase implements Closeable { + + private final CircuitBreakerFailoverConnectionProvider failoverProvider; + private final Queue>> commands = new LinkedList<>(); + + public MultiClusterPipeline(MultiClusterPooledConnectionProvider pooledProvider) { + super(new CommandObjects()); + try (Connection connection = pooledProvider.getConnection()) { // we don't need a healthy connection now + RedisProtocol proto = connection.getRedisProtocol(); + if (proto != null) this.commandObjects.setProtocol(proto); + } + + this.failoverProvider = new CircuitBreakerFailoverConnectionProvider(pooledProvider); + } + + @Override + protected final Response appendCommand(CommandObject commandObject) { + CommandArguments args = commandObject.getArguments(); + Response response = new Response<>(commandObject.getBuilder()); + commands.add(KeyValue.of(args, response)); + return response; + } + + @Override + public void close() { + sync(); + // connection prepared and closed (in try-with-resources) in sync() + } + + /** + * Synchronize pipeline by reading all responses. This operation close the pipeline. In order to get return values + * from pipelined commands, capture the different Response<?> of the commands you execute. + */ + @Override + public void sync() { + if (commands.isEmpty()) return; + + try (Connection connection = failoverProvider.getConnection()) { + + commands.forEach((command) -> connection.sendCommand(command.getKey())); + // following connection.getMany(int) flushes anyway, so no flush here. + + List unformatted = connection.getMany(commands.size()); + unformatted.forEach((rawReply) -> commands.poll().getValue().set(rawReply)); + } + } + + public Response waitReplicas(int replicas, long timeout) { + return appendCommand(commandObjects.waitReplicas(replicas, timeout)); + } + + public Response> waitAOF(long numLocal, long numReplicas, long timeout) { + return appendCommand(commandObjects.waitAOF(numLocal, numReplicas, timeout)); + } + + // RedisGraph commands + @Override + public Response graphQuery(String name, String query) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphQuery(String name, String query, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphQuery(String name, String query, Map params) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query, Map params) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphQuery(String name, String query, Map params, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query, Map params, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphDelete(String name) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response> graphProfile(String graphName, String query) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + // RedisGraph commands +} diff --git a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java new file mode 100644 index 0000000000..5ce9ecd9b5 --- /dev/null +++ b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java @@ -0,0 +1,245 @@ +package redis.clients.jedis.mcf; + +import static redis.clients.jedis.Protocol.Command.DISCARD; +import static redis.clients.jedis.Protocol.Command.EXEC; +import static redis.clients.jedis.Protocol.Command.MULTI; +import static redis.clients.jedis.Protocol.Command.UNWATCH; +import static redis.clients.jedis.Protocol.Command.WATCH; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.concurrent.atomic.AtomicInteger; + +import redis.clients.jedis.*; +import redis.clients.jedis.exceptions.JedisDataException; +import redis.clients.jedis.graph.ResultSet; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider; +import redis.clients.jedis.util.KeyValue; + +/** + * This is high memory dependent solution as all the appending commands will be hold in memory. + */ +public class MultiClusterTransaction extends TransactionBase { + + private static final Builder NO_OP_BUILDER = BuilderFactory.RAW_OBJECT; + + private final CircuitBreakerFailoverConnectionProvider provider; + private final AtomicInteger extraCommandCount = new AtomicInteger(); + private final Queue>> commands = new LinkedList<>(); + + private boolean inWatch = false; + private boolean inMulti = false; + + /** + * A MULTI command will be added to be sent to server. WATCH/UNWATCH/MULTI commands must not be + * called with this object. + * @param provider + */ + public MultiClusterTransaction(MultiClusterPooledConnectionProvider provider) { + this(provider, true); + } + + /** + * A user wanting to WATCH/UNWATCH keys followed by a call to MULTI ({@link #multi()}) it should + * be {@code doMulti=false}. + * + * @param provider + * @param doMulti {@code false} should be set to enable manual WATCH, UNWATCH and MULTI + */ + public MultiClusterTransaction(MultiClusterPooledConnectionProvider provider, boolean doMulti) { + try (Connection connection = provider.getConnection()) { // we don't need a healthy connection now + RedisProtocol proto = connection.getRedisProtocol(); + if (proto != null) this.commandObjects.setProtocol(proto); + } + + this.provider = new CircuitBreakerFailoverConnectionProvider(provider); + + if (doMulti) multi(); + } + + @Override + public final void multi() { + appendCommand(new CommandObject<>(new CommandArguments(MULTI), NO_OP_BUILDER)); + extraCommandCount.incrementAndGet(); + inMulti = true; + } + + /** + * @param keys + * @return {@code null} + */ + @Override + public final String watch(String... keys) { + appendCommand(new CommandObject<>(new CommandArguments(WATCH).addObjects((Object[]) keys), NO_OP_BUILDER)); + extraCommandCount.incrementAndGet(); + inWatch = true; + return null; + } + + /** + * @param keys + * @return {@code null} + */ + @Override + public final String watch(byte[]... keys) { + appendCommand(new CommandObject<>(new CommandArguments(WATCH).addObjects((Object[]) keys), NO_OP_BUILDER)); + extraCommandCount.incrementAndGet(); + inWatch = true; + return null; + } + + /** + * @return {@code null} + */ + @Override + public final String unwatch() { + appendCommand(new CommandObject<>(new CommandArguments(UNWATCH), NO_OP_BUILDER)); + extraCommandCount.incrementAndGet(); + inWatch = false; + return null; + } + + @Override + protected final Response appendCommand(CommandObject commandObject) { + CommandArguments args = commandObject.getArguments(); + Response response = new Response<>(commandObject.getBuilder()); + commands.add(KeyValue.of(args, response)); + return response; + } + + @Override + public void close() { + clear(); + } + + private void clear() { + if (inMulti) { + discard(); + } else if (inWatch) { + unwatch(); + } + } + + @Override + public final List exec() { + if (!inMulti) { + throw new IllegalStateException("EXEC without MULTI"); + } + + try (Connection connection = provider.getConnection()) { + + commands.forEach((command) -> connection.sendCommand(command.getKey())); + // following connection.getMany(int) flushes anyway, so no flush here. + + // ignore QUEUED (or ERROR) + connection.getMany(commands.size()); + + // remove extra response builders + for (int idx = 0; idx < extraCommandCount.get(); ++idx) { + commands.poll(); + } + + connection.sendCommand(EXEC); + + List unformatted = connection.getObjectMultiBulkReply(); + if (unformatted == null) { + commands.clear(); + return null; + } + + List formatted = new ArrayList<>(unformatted.size() - extraCommandCount.get()); + for (Object rawReply: unformatted) { + try { + Response response = commands.poll().getValue(); + response.set(rawReply); + formatted.add(response.get()); + } catch (JedisDataException e) { + formatted.add(e); + } + } + return formatted; + + } finally { + inMulti = false; + inWatch = false; + } + } + + @Override + public final String discard() { + if (!inMulti) { + throw new IllegalStateException("DISCARD without MULTI"); + } + + try (Connection connection = provider.getConnection()) { + + commands.forEach((command) -> connection.sendCommand(command.getKey())); + // following connection.getMany(int) flushes anyway, so no flush here. + + // ignore QUEUED (or ERROR) + connection.getMany(commands.size()); + + connection.sendCommand(DISCARD); + + return connection.getStatusCodeReply(); + } finally { + inMulti = false; + inWatch = false; + } + } + + // RedisGraph commands + @Override + public Response graphQuery(String name, String query) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphQuery(String name, String query, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphQuery(String name, String query, Map params) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query, Map params) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphQuery(String name, String query, Map params, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphReadonlyQuery(String name, String query, Map params, long timeout) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response graphDelete(String name) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + + @Override + public Response> graphProfile(String graphName, String query) { + throw new UnsupportedOperationException("Graph commands are not supported."); + } + // RedisGraph commands +} diff --git a/src/main/java/redis/clients/jedis/mcf/package-info.java b/src/main/java/redis/clients/jedis/mcf/package-info.java new file mode 100644 index 0000000000..6b89d9c77b --- /dev/null +++ b/src/main/java/redis/clients/jedis/mcf/package-info.java @@ -0,0 +1,4 @@ +/** + * This package contains the classes that are related to Active-Active cluster(s) and Multi-Cluster failover. + */ +package redis.clients.jedis.mcf; diff --git a/src/main/java/redis/clients/jedis/params/MigrateParams.java b/src/main/java/redis/clients/jedis/params/MigrateParams.java index 3b9815e7c3..a75251e0e4 100644 --- a/src/main/java/redis/clients/jedis/params/MigrateParams.java +++ b/src/main/java/redis/clients/jedis/params/MigrateParams.java @@ -8,7 +8,7 @@ public class MigrateParams implements IParams { private boolean copy = false; private boolean replace = false; private String username = null; - private String passowrd = null; + private String password = null; public MigrateParams() { } @@ -28,13 +28,13 @@ public MigrateParams replace() { } public MigrateParams auth(String password) { - this.passowrd = password; + this.password = password; return this; } public MigrateParams auth2(String username, String password) { this.username = username; - this.passowrd = password; + this.password = password; return this; } @@ -47,9 +47,9 @@ public void addParams(CommandArguments args) { args.add(Keyword.REPLACE); } if (username != null) { - args.add(Keyword.AUTH2).add(username).add(passowrd); - } else if (passowrd != null) { - args.add(Keyword.AUTH).add(passowrd); + args.add(Keyword.AUTH2).add(username).add(password); + } else if (password != null) { + args.add(Keyword.AUTH).add(password); } } } diff --git a/src/main/java/redis/clients/jedis/params/ZAddParams.java b/src/main/java/redis/clients/jedis/params/ZAddParams.java index d00b05c23d..8194c041a6 100644 --- a/src/main/java/redis/clients/jedis/params/ZAddParams.java +++ b/src/main/java/redis/clients/jedis/params/ZAddParams.java @@ -5,7 +5,7 @@ public class ZAddParams implements IParams { - private Keyword existance; + private Keyword existence; private Keyword comparison; private boolean change; @@ -21,16 +21,16 @@ public static ZAddParams zAddParams() { * @return ZAddParams */ public ZAddParams nx() { - this.existance = Keyword.NX; + this.existence = Keyword.NX; return this; } /** - * Only set the key if it already exist. + * Only set the key if it already exists. * @return ZAddParams */ public ZAddParams xx() { - this.existance = Keyword.XX; + this.existence = Keyword.XX; return this; } @@ -64,8 +64,8 @@ public ZAddParams ch() { @Override public void addParams(CommandArguments args) { - if (existance != null) { - args.add(existance); + if (existence != null) { + args.add(existence); } if (comparison != null) { args.add(comparison); diff --git a/src/main/java/redis/clients/jedis/providers/ClusterConnectionProvider.java b/src/main/java/redis/clients/jedis/providers/ClusterConnectionProvider.java index 4c47f2094b..c21640713d 100644 --- a/src/main/java/redis/clients/jedis/providers/ClusterConnectionProvider.java +++ b/src/main/java/redis/clients/jedis/providers/ClusterConnectionProvider.java @@ -1,5 +1,6 @@ package redis.clients.jedis.providers; +import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -17,9 +18,9 @@ import redis.clients.jedis.exceptions.JedisClusterOperationException; import redis.clients.jedis.exceptions.JedisException; -public class ClusterConnectionProvider implements ConnectionProvider { +import static redis.clients.jedis.JedisCluster.INIT_NO_ERROR_PROPERTY; - private static final String INIT_NO_ERROR_PROPERTY = "jedis.cluster.initNoError"; +public class ClusterConnectionProvider implements ConnectionProvider { protected final JedisClusterInfoCache cache; @@ -34,6 +35,12 @@ public ClusterConnectionProvider(Set clusterNodes, JedisClientConfi initializeSlotsCache(clusterNodes, clientConfig); } + public ClusterConnectionProvider(Set clusterNodes, JedisClientConfig clientConfig, + GenericObjectPoolConfig poolConfig, Duration topologyRefreshPeriod) { + this.cache = new JedisClusterInfoCache(clientConfig, poolConfig, clusterNodes, topologyRefreshPeriod); + initializeSlotsCache(clusterNodes, clientConfig); + } + private void initializeSlotsCache(Set startNodes, JedisClientConfig clientConfig) { if (startNodes.isEmpty()) { throw new JedisClusterOperationException("No nodes to initialize cluster slots cache."); @@ -66,7 +73,7 @@ private void initializeSlotsCache(Set startNodes, JedisClientConfig @Override public void close() { - cache.reset(); + cache.close(); } public void renewSlotCache() { diff --git a/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java b/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java index 09ef3a43bb..930c9b064d 100644 --- a/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java +++ b/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java @@ -6,7 +6,7 @@ /** * This class holds information about an Access Control Log entry (returned by ACL LOG command) They - * can be access via getters. For future purpose there is also {@link #getlogEntry} method that + * can be accessed via getters. For future purpose there is also {@link #getlogEntry} method that * returns a generic {@code Map} - in case where more info is returned from a server */ // TODO: remove diff --git a/src/main/java/redis/clients/jedis/resps/ClusterShardInfo.java b/src/main/java/redis/clients/jedis/resps/ClusterShardInfo.java new file mode 100644 index 0000000000..8e7394bccc --- /dev/null +++ b/src/main/java/redis/clients/jedis/resps/ClusterShardInfo.java @@ -0,0 +1,44 @@ +package redis.clients.jedis.resps; + +import java.util.List; +import java.util.Map; + +/** + * This class holds information about a shard of the cluster with command {@code CLUSTER SHARDS}. + * They can be accessed via getters. There is also {@link ClusterShardInfo#getClusterShardInfo()} + * method that returns a generic {@link Map} in case more info are returned from the server. + */ +public class ClusterShardInfo { + + public static final String SLOTS = "slots"; + public static final String NODES = "nodes"; + + private final List> slots; + private final List nodes; + + private final Map clusterShardInfo; + + /** + * @param map contains key-value pairs with cluster shard info + */ + @SuppressWarnings("unchecked") + public ClusterShardInfo(Map map) { + slots = (List>) map.get(SLOTS); + nodes = (List) map.get(NODES); + + clusterShardInfo = map; + } + + public List> getSlots() { + return slots; + } + + public List getNodes() { + return nodes; + } + + public Map getClusterShardInfo() { + return clusterShardInfo; + } + +} diff --git a/src/main/java/redis/clients/jedis/resps/ClusterShardNodeInfo.java b/src/main/java/redis/clients/jedis/resps/ClusterShardNodeInfo.java new file mode 100644 index 0000000000..6e245de4d2 --- /dev/null +++ b/src/main/java/redis/clients/jedis/resps/ClusterShardNodeInfo.java @@ -0,0 +1,94 @@ +package redis.clients.jedis.resps; + +import java.util.Map; + +/** + * This class holds information about a node of the cluster with command {@code CLUSTER SHARDS}. + * They can be accessed via getters. There is also {@link ClusterShardNodeInfo#getClusterShardNodeInfo()} + * method that returns a generic {@link Map} in case more info are returned from the server. + */ +public class ClusterShardNodeInfo { + + public static final String ID = "id"; + public static final String ENDPOINT = "endpoint"; + public static final String IP = "ip"; + public static final String HOSTNAME = "hostname"; + public static final String PORT = "port"; + public static final String TLS_PORT = "tls-port"; + public static final String ROLE = "role"; + public static final String REPLICATION_OFFSET = "replication-offset"; + public static final String HEALTH = "health"; + + private final String id; + private final String endpoint; + private final String ip; + private final String hostname; + private final Long port; + private final Long tlsPort; + private final String role; + private final Long replicationOffset; + private final String health; + + private final Map clusterShardNodeInfo; + + /** + * @param map contains key-value pairs with node info + */ + public ClusterShardNodeInfo(Map map) { + id = (String) map.get(ID); + endpoint = (String) map.get(ENDPOINT); + ip = (String) map.get(IP); + hostname = (String) map.get(HOSTNAME); + port = (Long) map.get(PORT); + tlsPort = (Long) map.get(TLS_PORT); + role = (String) map.get(ROLE); + replicationOffset = (Long) map.get(REPLICATION_OFFSET); + health = (String) map.get(HEALTH); + + clusterShardNodeInfo = map; + } + + public String getId() { + return id; + } + + public String getEndpoint() { + return endpoint; + } + + public String getIp() { + return ip; + } + + public String getHostname() { + return hostname; + } + + public Long getPort() { + return port; + } + + public Long getTlsPort() { + return tlsPort; + } + + public String getRole() { + return role; + } + + public Long getReplicationOffset() { + return replicationOffset; + } + + public String getHealth() { + return health; + } + + public Map getClusterShardNodeInfo() { + return clusterShardNodeInfo; + } + + public boolean isSsl() { + return tlsPort != null; + } +} diff --git a/src/main/java/redis/clients/jedis/resps/GeoRadiusResponse.java b/src/main/java/redis/clients/jedis/resps/GeoRadiusResponse.java index 03a51b2525..d4442bd725 100644 --- a/src/main/java/redis/clients/jedis/resps/GeoRadiusResponse.java +++ b/src/main/java/redis/clients/jedis/resps/GeoRadiusResponse.java @@ -4,8 +4,10 @@ import redis.clients.jedis.util.SafeEncoder; import java.util.Arrays; +import java.util.Objects; public class GeoRadiusResponse { + private byte[] member; private double distance; private GeoCoordinate coordinate; @@ -23,6 +25,10 @@ public void setCoordinate(GeoCoordinate coordinate) { this.coordinate = coordinate; } + public void setRawScore(long rawScore) { + this.rawScore = rawScore; + } + public byte[] getMember() { return member; } @@ -31,22 +37,30 @@ public String getMemberByString() { return SafeEncoder.encode(member); } + /** + * @return The distance of the returned item from the specified center. The distance is returned + * in the same unit as the unit specified as the radius argument of the command. + */ public double getDistance() { return distance; } + /** + * @return The longitude,latitude coordinates of the matching item. + */ public GeoCoordinate getCoordinate() { return coordinate; } + /** + * @return The raw geohash-encoded sorted set score of the item, in the form of a 52 bit unsigned + * integer. This is only useful for low level hacks or debugging and is otherwise of little + * interest for the general user. + */ public long getRawScore() { return rawScore; } - public void setRawScore(long rawScore) { - this.rawScore = rawScore; - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -62,4 +76,14 @@ public boolean equals(Object obj) { && rawScore == response.getRawScore() && coordinate.equals(response.coordinate) && Arrays.equals(member, response.getMember()); } + + @Override + public int hashCode() { + int hash = 7; + hash = 67 * hash + Arrays.hashCode(this.member); + hash = 67 * hash + (int) (Double.doubleToLongBits(this.distance) ^ (Double.doubleToLongBits(this.distance) >>> 32)); + hash = 67 * hash + Objects.hashCode(this.coordinate); + hash = 67 * hash + (int) (this.rawScore ^ (this.rawScore >>> 32)); + return hash; + } } diff --git a/src/main/java/redis/clients/jedis/resps/LibraryInfo.java b/src/main/java/redis/clients/jedis/resps/LibraryInfo.java index 6471ac9ba7..41cbd49dd3 100644 --- a/src/main/java/redis/clients/jedis/resps/LibraryInfo.java +++ b/src/main/java/redis/clients/jedis/resps/LibraryInfo.java @@ -47,7 +47,7 @@ public String getLibraryCode() { return libraryCode; } - public static final Builder LIBRARY_BUILDER = new Builder() { + public static final Builder LIBRARY_INFO = new Builder() { @Override public LibraryInfo build(Object data) { if (data == null) return null; @@ -88,4 +88,18 @@ public LibraryInfo build(Object data) { } }; + /** + * @deprecated Use {@link LibraryInfo#LIBRARY_INFO}. + */ + @Deprecated + public static final Builder LIBRARY_BUILDER = LIBRARY_INFO; + + public static final Builder> LIBRARY_INFO_LIST = new Builder>() { + @Override + public List build(Object data) { + List list = (List) data; + return list.stream().map(o -> LibraryInfo.LIBRARY_INFO.build(o)).collect(Collectors.toList()); + } + }; + } diff --git a/src/main/java/redis/clients/jedis/resps/StreamConsumerFullInfo.java b/src/main/java/redis/clients/jedis/resps/StreamConsumerFullInfo.java index 6279640888..2f57329415 100644 --- a/src/main/java/redis/clients/jedis/resps/StreamConsumerFullInfo.java +++ b/src/main/java/redis/clients/jedis/resps/StreamConsumerFullInfo.java @@ -7,7 +7,7 @@ /** * This class holds information about a stream consumer with command - * {@code xinfo stream mystream full}. They can be access via getters. There is also + * {@code xinfo stream mystream full}. They can be accessed via getters. There is also * {@link StreamConsumerFullInfo#getConsumerInfo()} method that returns a generic {@link Map} in * case more info are returned from the server. */ diff --git a/src/main/java/redis/clients/jedis/resps/StreamConsumerInfo.java b/src/main/java/redis/clients/jedis/resps/StreamConsumerInfo.java index 63b417780e..0bf5a46250 100644 --- a/src/main/java/redis/clients/jedis/resps/StreamConsumerInfo.java +++ b/src/main/java/redis/clients/jedis/resps/StreamConsumerInfo.java @@ -3,7 +3,7 @@ import java.util.Map; /** - * This class holds information about a consumer. They can be access via getters. There is also + * This class holds information about a consumer. They can be accessed via getters. There is also * {@link StreamConsumersInfo#getConsumerInfo()}} method that returns a generic {@code Map} in case * more info are returned from the server. */ diff --git a/src/main/java/redis/clients/jedis/resps/StreamConsumersInfo.java b/src/main/java/redis/clients/jedis/resps/StreamConsumersInfo.java index ad12f0353b..4b12a95006 100644 --- a/src/main/java/redis/clients/jedis/resps/StreamConsumersInfo.java +++ b/src/main/java/redis/clients/jedis/resps/StreamConsumersInfo.java @@ -3,7 +3,7 @@ import java.util.Map; /** - * This class holds information about a consumer. They can be access via getters. There is also + * This class holds information about a consumer. They can be accessed via getters. There is also * {@link StreamConsumersInfo#getConsumerInfo()}} method that returns a generic {@code Map} in case * more info are returned from the server. * @deprecated Use {@link StreamConsumerInfo}. diff --git a/src/main/java/redis/clients/jedis/resps/StreamFullInfo.java b/src/main/java/redis/clients/jedis/resps/StreamFullInfo.java index 336bf9c9c2..e768b536b8 100644 --- a/src/main/java/redis/clients/jedis/resps/StreamFullInfo.java +++ b/src/main/java/redis/clients/jedis/resps/StreamFullInfo.java @@ -8,7 +8,7 @@ /** * This class holds information about a stream info with command {@code xinfo stream mystream full}. - * They can be access via getters. There is also {@link StreamFullInfo#getStreamFullInfo()} method + * They can be accessed via getters. There is also {@link StreamFullInfo#getStreamFullInfo()} method * that returns a generic {@link Map} in case where more info are returned from the server. */ public class StreamFullInfo implements Serializable { diff --git a/src/main/java/redis/clients/jedis/resps/StreamGroupFullInfo.java b/src/main/java/redis/clients/jedis/resps/StreamGroupFullInfo.java index 8472c6b7b6..8354c86815 100644 --- a/src/main/java/redis/clients/jedis/resps/StreamGroupFullInfo.java +++ b/src/main/java/redis/clients/jedis/resps/StreamGroupFullInfo.java @@ -8,7 +8,7 @@ /** * This class holds information about a stream group with command {@code xinfo stream mystream full}. - * They can be access via getters. There is also {@link StreamGroupFullInfo#getGroupFullInfo()} + * They can be accessed via getters. There is also {@link StreamGroupFullInfo#getGroupFullInfo()} * method that returns a generic {@link Map} in case more info are returned from the server. */ public class StreamGroupFullInfo implements Serializable { diff --git a/src/main/java/redis/clients/jedis/resps/StreamGroupInfo.java b/src/main/java/redis/clients/jedis/resps/StreamGroupInfo.java index d017701142..0531bb8fb5 100644 --- a/src/main/java/redis/clients/jedis/resps/StreamGroupInfo.java +++ b/src/main/java/redis/clients/jedis/resps/StreamGroupInfo.java @@ -5,7 +5,7 @@ import redis.clients.jedis.StreamEntryID; /** - * This class holds information about a stream group. They can be access via getters. There is also + * This class holds information about a stream group. They can be accessed via getters. There is also * {@link StreamGroupInfo#getGroupInfo()} method that returns a generic {@code Map} in case more * info are returned from the server. */ diff --git a/src/main/java/redis/clients/jedis/resps/StreamInfo.java b/src/main/java/redis/clients/jedis/resps/StreamInfo.java index 39e65b1202..a866f41e4c 100644 --- a/src/main/java/redis/clients/jedis/resps/StreamInfo.java +++ b/src/main/java/redis/clients/jedis/resps/StreamInfo.java @@ -5,7 +5,7 @@ import redis.clients.jedis.StreamEntryID; /** - * This class holds information about stream. They can be access via getters. There is also + * This class holds information about stream. They can be accessed via getters. There is also * {@link StreamInfo#getStreamInfo} method that returns a generic {@code Map} in case more info are * returned from the server. */ diff --git a/src/main/java/redis/clients/jedis/search/Document.java b/src/main/java/redis/clients/jedis/search/Document.java index 9e126b948b..20149e581a 100644 --- a/src/main/java/redis/clients/jedis/search/Document.java +++ b/src/main/java/redis/clients/jedis/search/Document.java @@ -3,9 +3,13 @@ import redis.clients.jedis.util.SafeEncoder; import java.io.Serializable; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import redis.clients.jedis.Builder; +import redis.clients.jedis.BuilderFactory; +import redis.clients.jedis.util.KeyValue; /** * Document represents a single indexed document or entity in the engine @@ -15,29 +19,35 @@ public class Document implements Serializable { private static final long serialVersionUID = 4884173545291367373L; private final String id; - private double score; - private final Map properties; - - public Document(String id, double score) { - this(id, new HashMap<>(), score); - } + private Double score; + private final Map fields; public Document(String id) { this(id, 1.0); } + public Document(String id, double score) { + this(id, new HashMap<>(), score); + } + public Document(String id, Map fields) { this(id, fields, 1.0f); } public Document(String id, Map fields, double score) { this.id = id; - this.properties = fields; + this.fields = fields; + this.score = score; + } + + private Document(String id, Double score, Map fields) { + this.id = id; this.score = score; + this.fields = fields; } public Iterable> getProperties() { - return properties.entrySet(); + return fields.entrySet(); } public static Document load(String id, double score, byte[] payload, List fields) { @@ -58,9 +68,18 @@ public static Document load(String id, double score, List fields, boolea return ret; } - public Document set(String key, Object value) { - properties.put(key, value); - return this; + /** + * @return the document's id + */ + public String getId() { + return id; + } + + /** + * @return the document's score + */ + public Double getScore() { + return score; } /** @@ -71,7 +90,7 @@ public Document set(String key, Object value) { * @return the property value */ public Object get(String key) { - return properties.get(key); + return fields.get(key); } /** @@ -82,18 +101,20 @@ public Object get(String key) { * @return the property value */ public String getString(String key) { - Object value = properties.get(key); + Object value = fields.get(key); if (value instanceof String) { return (String) value; } return value instanceof byte[] ? SafeEncoder.encode((byte[]) value) : value.toString(); } - /** - * @return the document's score - */ - public double getScore() { - return score; + public boolean hasProperty(String key) { + return fields.containsKey(key); + } + + public Document set(String key, Object value) { + fields.put(key, value); + return this; } /** @@ -103,24 +124,46 @@ public double getScore() { * @return the document itself */ public Document setScore(float score) { - this.score = score; + this.score = (double) score; return this; } - /** - * @return the document's id - */ - public String getId() { - return id; - } - - public boolean hasProperty(String key) { - return properties.containsKey(key); - } - @Override public String toString() { return "id:" + this.getId() + ", score: " + this.getScore() + ", properties:" + this.getProperties(); } + + static Builder SEARCH_DOCUMENT = new Builder() { + + private static final String ID_STR = "id"; + private static final String SCORE_STR = "score"; + // private static final String FIELDS_STR = "fields"; + private static final String FIELDS_STR = "extra_attributes"; + + @Override + public Document build(Object data) { + List list = (List) data; + String id = null; + Double score = null; + Map fields = null; + for (KeyValue kv : list) { + String key = BuilderFactory.STRING.build(kv.getKey()); + switch (key) { + case ID_STR: + id = BuilderFactory.STRING.build(kv.getValue()); + break; + case SCORE_STR: + score = BuilderFactory.DOUBLE.build(kv.getValue()); + break; + case FIELDS_STR: + fields = BuilderFactory.ENCODED_OBJECT_MAP.build(kv.getValue()); + break; + } + } +// assert id != null; +// if (fields == null) fields = Collections.emptyMap(); + return new Document(id, score, fields); + } + }; } diff --git a/src/main/java/redis/clients/jedis/search/FieldName.java b/src/main/java/redis/clients/jedis/search/FieldName.java index 452b0b8d61..9a0a9329db 100644 --- a/src/main/java/redis/clients/jedis/search/FieldName.java +++ b/src/main/java/redis/clients/jedis/search/FieldName.java @@ -30,6 +30,14 @@ public FieldName as(String attribute) { return this; } + public final String getName() { + return name; + } + + public final String getAttribute() { + return attribute; + } + public int addCommandArguments(List args) { args.add(name); if (attribute == null) { diff --git a/src/main/java/redis/clients/jedis/search/FtSearchIteration.java b/src/main/java/redis/clients/jedis/search/FtSearchIteration.java index d8686e2186..c856e5d780 100644 --- a/src/main/java/redis/clients/jedis/search/FtSearchIteration.java +++ b/src/main/java/redis/clients/jedis/search/FtSearchIteration.java @@ -4,6 +4,7 @@ import java.util.function.IntFunction; import redis.clients.jedis.CommandArguments; +import redis.clients.jedis.RedisProtocol; import redis.clients.jedis.providers.ConnectionProvider; import redis.clients.jedis.search.SearchResult.SearchResultBuilder; import redis.clients.jedis.util.JedisCommandIterationBase; @@ -18,7 +19,22 @@ public class FtSearchIteration extends JedisCommandIterationBase new CommandArguments(SearchProtocol.SearchCommand.SEARCH) .add(indexName).add(query).addParams(params.limit(limitFirst, this.batchSize)); @@ -27,8 +43,9 @@ public FtSearchIteration(ConnectionProvider connectionProvider, int batchSize, S /** * {@link Query#limit(java.lang.Integer, java.lang.Integer)} will be ignored. */ - public FtSearchIteration(ConnectionProvider connectionProvider, int batchSize, String indexName, Query query) { - super(connectionProvider, new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true)); + public FtSearchIteration(ConnectionProvider connectionProvider, RedisProtocol protocol, int batchSize, String indexName, Query query) { + super(connectionProvider, protocol == RedisProtocol.RESP3 ? SearchResult.SEARCH_RESULT_BUILDER + : new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true)); this.batchSize = batchSize; this.args = (limitFirst) -> new CommandArguments(SearchProtocol.SearchCommand.SEARCH) .add(indexName).addParams(query.limit(limitFirst, this.batchSize)); diff --git a/src/main/java/redis/clients/jedis/search/RediSearchCommands.java b/src/main/java/redis/clients/jedis/search/RediSearchCommands.java index d128babf83..f361689aea 100644 --- a/src/main/java/redis/clients/jedis/search/RediSearchCommands.java +++ b/src/main/java/redis/clients/jedis/search/RediSearchCommands.java @@ -40,6 +40,16 @@ default String ftAlter(String indexName, SchemaField... schemaFields) { String ftAlter(String indexName, Iterable schemaFields); + String ftAliasAdd(String aliasName, String indexName); + + String ftAliasUpdate(String aliasName, String indexName); + + String ftAliasDel(String aliasName); + + String ftDropIndex(String indexName); + + String ftDropIndexDD(String indexName); + default SearchResult ftSearch(String indexName) { return ftSearch(indexName, "*"); } @@ -50,6 +60,7 @@ default SearchResult ftSearch(String indexName) { SearchResult ftSearch(String indexName, Query query); + @Deprecated SearchResult ftSearch(byte[] indexName, Query query); String ftExplain(String indexName, Query query); @@ -71,10 +82,6 @@ Map.Entry> ftProfileSearch(String indexName, Map.Entry> ftProfileSearch(String indexName, FTProfileParams profileParams, String query, FTSearchParams searchParams); - String ftDropIndex(String indexName); - - String ftDropIndexDD(String indexName); - String ftSynUpdate(String indexName, String synonymGroupId, String... terms); Map> ftSynDump(String indexName); @@ -100,15 +107,9 @@ Map> ftSpellCheck(String index, String query, Set ftTagVals(String indexName, String fieldName); - String ftAliasAdd(String aliasName, String indexName); - - String ftAliasUpdate(String aliasName, String indexName); - - String ftAliasDel(String aliasName); - - Map ftConfigGet(String option); + Map ftConfigGet(String option); - Map ftConfigGet(String indexName, String option); + Map ftConfigGet(String indexName, String option); String ftConfigSet(String option, String value); @@ -130,5 +131,5 @@ Map> ftSpellCheck(String index, String query, long ftSugLen(String key); - List ftList(); + Set ftList(); } diff --git a/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java b/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java index 87a4954a4f..c5765a6f31 100644 --- a/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java @@ -41,6 +41,16 @@ default Response ftAlter(String indexName, SchemaField... schemaFields) Response ftAlter(String indexName, Iterable schemaFields); + Response ftAliasAdd(String aliasName, String indexName); + + Response ftAliasUpdate(String aliasName, String indexName); + + Response ftAliasDel(String aliasName); + + Response ftDropIndex(String indexName); + + Response ftDropIndexDD(String indexName); + default Response ftSearch(String indexName) { return ftSearch(indexName, "*"); } @@ -51,6 +61,7 @@ default Response ftSearch(String indexName) { Response ftSearch(String indexName, Query query); + @Deprecated Response ftSearch(byte[] indexName, Query query); Response ftExplain(String indexName, Query query); @@ -84,9 +95,9 @@ Response>> ftSpellCheck(String index, String que Response> ftTagVals(String indexName, String fieldName); - Response> ftConfigGet(String option); + Response> ftConfigGet(String option); - Response> ftConfigGet(String indexName, String option); + Response> ftConfigGet(String indexName, String option); Response ftConfigSet(String option, String value); diff --git a/src/main/java/redis/clients/jedis/search/RediSearchUtil.java b/src/main/java/redis/clients/jedis/search/RediSearchUtil.java index a6a82486b7..14cb963bde 100644 --- a/src/main/java/redis/clients/jedis/search/RediSearchUtil.java +++ b/src/main/java/redis/clients/jedis/search/RediSearchUtil.java @@ -3,8 +3,11 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import redis.clients.jedis.util.SafeEncoder; @@ -18,6 +21,18 @@ public class RediSearchUtil { * @return map with string value */ public static Map toStringMap(Map input) { + return toStringMap(input, false); + } + + /** + * Jedis' {@code hset} methods do not support {@link Object}s as values. This method eases process + * of converting a {@link Map} with Objects as values so that the returning Map can be set to a + * {@code hset} method. + * @param input map with object value + * @param stringEscape whether to escape the String objects + * @return map with string value + */ + public static Map toStringMap(Map input, boolean stringEscape) { Map output = new HashMap<>(input.size()); for (Map.Entry entry : input.entrySet()) { String key = entry.getKey(); @@ -32,9 +47,9 @@ public static Map toStringMap(Map input) { redis.clients.jedis.GeoCoordinate geo = (redis.clients.jedis.GeoCoordinate) obj; str = geo.getLongitude() + "," + geo.getLatitude(); } else if (obj instanceof String) { - str = (String) obj; + str = stringEscape ? escape((String) obj) : (String) obj; } else { - str = obj.toString(); + str = String.valueOf(obj); } output.put(key, str); } @@ -48,12 +63,53 @@ public static Map toStringMap(Map input) { * @param input float array * @return byte array */ - public static byte[] ToByteArray(float[] input) { + public static byte[] toByteArray(float[] input) { byte[] bytes = new byte[Float.BYTES * input.length]; ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).asFloatBuffer().put(input); return bytes; } + /** + * @deprecated Use {@link RediSearchUtil#toByteArray(float[])}. + */ + @Deprecated + public static byte[] ToByteArray(float[] input) { + return toByteArray(input); + } + + private static final Set ESCAPE_CHARS = new HashSet<>(Arrays.asList(// + ',', '.', '<', '>', '{', '}', '[', // + ']', '"', '\'', ':', ';', '!', '@', // + '#', '$', '%', '^', '&', '*', '(', // + ')', '-', '+', '=', '~', '|' // + )); + + public static String escape(String text) { + return escape(text, false); + } + + public static String escapeQuery(String query) { + return escape(query, true); + } + + public static String escape(String text, boolean querying) { + char[] chars = text.toCharArray(); + + StringBuilder sb = new StringBuilder(); + for (char ch : chars) { + if (ESCAPE_CHARS.contains(ch) + || (querying && ch == ' ')) { + sb.append("\\"); + } + sb.append(ch); + } + return sb.toString(); + } + + public static String unescape(String text) { + return text.replace("\\", ""); + } + private RediSearchUtil() { throw new InstantiationError("Must not instantiate this class"); } diff --git a/src/main/java/redis/clients/jedis/search/SearchBuilderFactory.java b/src/main/java/redis/clients/jedis/search/SearchBuilderFactory.java index e4490efdfb..8702b4a307 100644 --- a/src/main/java/redis/clients/jedis/search/SearchBuilderFactory.java +++ b/src/main/java/redis/clients/jedis/search/SearchBuilderFactory.java @@ -3,34 +3,21 @@ import static redis.clients.jedis.BuilderFactory.STRING; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import redis.clients.jedis.Builder; import redis.clients.jedis.BuilderFactory; -import redis.clients.jedis.search.aggr.AggregationResult; import redis.clients.jedis.util.DoublePrecision; +import redis.clients.jedis.util.KeyValue; import redis.clients.jedis.util.SafeEncoder; public final class SearchBuilderFactory { - public static final Builder SEARCH_AGGREGATION_RESULT = new Builder() { - @Override - public AggregationResult build(Object data) { - return new AggregationResult(data); - } - }; - - public static final Builder SEARCH_AGGREGATION_RESULT_WITH_CURSOR = new Builder() { - @Override - public AggregationResult build(Object data) { - List list = (List) data; - return new AggregationResult(list.get(0), (long) list.get(1)); - } - }; - public static final Builder> SEARCH_PROFILE_PROFILE = new Builder>() { private final String ITERATORS_PROFILE_STR = "Iterators profile"; @@ -131,7 +118,14 @@ private Object parseIterators(Object data) { public static final Builder>> SEARCH_SYNONYM_GROUPS = new Builder>>() { @Override public Map> build(Object data) { - List list = (List) data; + List list = (List) data; + if (list.isEmpty()) return Collections.emptyMap(); + + if (list.get(0) instanceof KeyValue) { + return ((List) data).stream().collect(Collectors.toMap( + kv -> STRING.build(kv.getKey()), kv -> BuilderFactory.STRING_LIST.build(kv.getValue()))); + } + Map> dump = new HashMap<>(list.size() / 2, 1f); for (int i = 0; i < list.size(); i += 2) { dump.put(STRING.build(list.get(i)), BuilderFactory.STRING_LIST.build(list.get(i + 1))); @@ -143,15 +137,33 @@ public Map> build(Object data) { public static final Builder>> SEARCH_SPELLCHECK_RESPONSE = new Builder>>() { - private final String TERM = "TERM"; + private static final String TERM = "TERM"; + private static final String RESULTS = "results"; @Override public Map> build(Object data) { - List rawTerms = (List) data; - Map> returnTerms = new LinkedHashMap<>(rawTerms.size()); + List rawDataList = (List) data; + if (rawDataList.isEmpty()) return Collections.emptyMap(); + + if (rawDataList.get(0) instanceof KeyValue) { + KeyValue rawData = (KeyValue) rawDataList.get(0); + String header = STRING.build(rawData.getKey()); + if (!RESULTS.equals(header)) { + throw new IllegalStateException("Unrecognized header: " + header); + } + + return ((List) rawData.getValue()).stream().collect(Collectors.toMap( + rawTerm -> STRING.build(rawTerm.getKey()), + rawTerm -> ((List>) rawTerm.getValue()).stream() + .collect(Collectors.toMap(entry -> STRING.build(entry.get(0).getKey()), + entry -> BuilderFactory.DOUBLE.build(entry.get(0).getValue()))), + (x, y) -> x, LinkedHashMap::new)); + } + + Map> returnTerms = new LinkedHashMap<>(rawDataList.size()); - for (Object rawTerm : rawTerms) { - List rawElements = (List) rawTerm; + for (Object rawData : rawDataList) { + List rawElements = (List) rawData; String header = STRING.build(rawElements.get(0)); if (!TERM.equals(header)) { diff --git a/src/main/java/redis/clients/jedis/search/SearchProtocol.java b/src/main/java/redis/clients/jedis/search/SearchProtocol.java index 36780b569b..7f2ad482fb 100644 --- a/src/main/java/redis/clients/jedis/search/SearchProtocol.java +++ b/src/main/java/redis/clients/jedis/search/SearchProtocol.java @@ -49,13 +49,13 @@ public byte[] getRaw() { public enum SearchKeyword implements Rawable { - SCHEMA, TEXT, TAG, NUMERIC, GEO, VECTOR, VERBATIM, NOCONTENT, NOSTOPWORDS, WITHSCORES, LANGUAGE, - INFIELDS, SORTBY, ASC, DESC, LIMIT, HIGHLIGHT, FIELDS, TAGS, SUMMARIZE, FRAGS, LEN, SEPARATOR, - INKEYS, RETURN, FILTER, GEOFILTER, ADD, INCR, MAX, FUZZY, READ, DEL, DD, TEMPORARY, STOPWORDS, - NOFREQS, NOFIELDS, NOOFFSETS, NOHL, SET, GET, ON, SORTABLE, UNF, PREFIX, LANGUAGE_FIELD, SCORE, - SCORE_FIELD, SCORER, PARAMS, AS, DIALECT, SLOP, TIMEOUT, INORDER, EXPANDER, MAXTEXTFIELDS, - SKIPINITIALSCAN, WITHSUFFIXTRIE, NOSTEM, NOINDEX, PHONETIC, WEIGHT, CASESENSITIVE, - LOAD, APPLY, GROUPBY, MAXIDLE, WITHCURSOR, DISTANCE, TERMS, INCLUDE, EXCLUDE, + SCHEMA, TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR, VERBATIM, NOCONTENT, NOSTOPWORDS, WITHSCORES, + LANGUAGE, INFIELDS, SORTBY, ASC, DESC, LIMIT, HIGHLIGHT, FIELDS, TAGS, SUMMARIZE, FRAGS, LEN, + SEPARATOR, INKEYS, RETURN, FILTER, GEOFILTER, ADD, INCR, MAX, FUZZY, READ, DEL, DD, TEMPORARY, + STOPWORDS, NOFREQS, NOFIELDS, NOOFFSETS, NOHL, SET, GET, ON, SORTABLE, UNF, PREFIX, + LANGUAGE_FIELD, SCORE, SCORE_FIELD, SCORER, PARAMS, AS, DIALECT, SLOP, TIMEOUT, INORDER, + EXPANDER, MAXTEXTFIELDS, SKIPINITIALSCAN, WITHSUFFIXTRIE, NOSTEM, NOINDEX, PHONETIC, WEIGHT, + CASESENSITIVE, LOAD, APPLY, GROUPBY, MAXIDLE, WITHCURSOR, DISTANCE, TERMS, INCLUDE, EXCLUDE, SEARCH, AGGREGATE, QUERY, LIMITED, COUNT, REDUCE; private final byte[] raw; diff --git a/src/main/java/redis/clients/jedis/search/SearchResult.java b/src/main/java/redis/clients/jedis/search/SearchResult.java index e756a54e6a..cc28cc942a 100644 --- a/src/main/java/redis/clients/jedis/search/SearchResult.java +++ b/src/main/java/redis/clients/jedis/search/SearchResult.java @@ -1,9 +1,12 @@ package redis.clients.jedis.search; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import redis.clients.jedis.Builder; import redis.clients.jedis.BuilderFactory; +import redis.clients.jedis.util.KeyValue; /** * SearchResult encapsulates the returned result from a search query. It contains publicly @@ -25,7 +28,13 @@ public long getTotalResults() { } public List getDocuments() { - return documents; + return Collections.unmodifiableList(documents); + } + + @Override + public String toString() { + return getClass().getSimpleName() + "{Total results:" + totalResults + + ", Documents:" + documents + "}"; } public static class SearchResultBuilder extends Builder { @@ -72,4 +81,31 @@ public SearchResult build(Object data) { return new SearchResult(totalResults, documents); } } + + public static Builder SEARCH_RESULT_BUILDER = new Builder() { + + private static final String TOTAL_RESULTS_STR = "total_results"; + private static final String RESULTS_STR = "results"; + + @Override + public SearchResult build(Object data) { + List list = (List) data; + long totalResults = -1; + List results = null; + for (KeyValue kv : list) { + String key = BuilderFactory.STRING.build(kv.getKey()); + switch (key) { + case TOTAL_RESULTS_STR: + totalResults = BuilderFactory.LONG.build(kv.getValue()); + break; + case RESULTS_STR: + results = ((List) kv.getValue()).stream() + .map(Document.SEARCH_DOCUMENT::build) + .collect(Collectors.toList()); + break; + } + } + return new SearchResult(totalResults, results); + } + }; } diff --git a/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java b/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java index 67133c5f18..cec65f9cd9 100644 --- a/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java +++ b/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java @@ -1,12 +1,16 @@ package redis.clients.jedis.search.aggr; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import redis.clients.jedis.Builder; +import redis.clients.jedis.BuilderFactory; import redis.clients.jedis.exceptions.JedisDataException; +import redis.clients.jedis.util.KeyValue; import redis.clients.jedis.util.SafeEncoder; public class AggregationResult { @@ -15,14 +19,14 @@ public class AggregationResult { private final List> results; - private long cursorId = -1; + private Long cursorId = -1L; - public AggregationResult(Object resp, long cursorId) { + private AggregationResult(Object resp, long cursorId) { this(resp); this.cursorId = cursorId; } - public AggregationResult(Object resp) { + private AggregationResult(Object resp) { List list = (List) SafeEncoder.encodeObject(resp); // the first element is always the number of results @@ -43,12 +47,25 @@ public AggregationResult(Object resp) { } } + private AggregationResult(long totalResults, List> results) { + this.totalResults = totalResults; + this.results = results; + } + + private void setCursorId(Long cursorId) { + this.cursorId = cursorId; + } + + public Long getCursorId() { + return cursorId; + } + public long getTotalResults() { return totalResults; } public List> getResults() { - return results; + return Collections.unmodifiableList(results); } /** @@ -63,7 +80,75 @@ public Row getRow(int index) { return new Row(results.get(index)); } - public long getCursorId() { - return cursorId; - } + public static final Builder SEARCH_AGGREGATION_RESULT = new Builder() { + + private static final String TOTAL_RESULTS_STR = "total_results"; + private static final String RESULTS_STR = "results"; + // private static final String FIELDS_STR = "fields"; + private static final String FIELDS_STR = "extra_attributes"; + + @Override + public AggregationResult build(Object data) { + // return new AggregationResult(data); + List list = (List) data; + + if (list.get(0) instanceof KeyValue) { + List kvList = (List) data; + long totalResults = -1; + List> results = null; + for (KeyValue kv : kvList) { + String key = BuilderFactory.STRING.build(kv.getKey()); + switch (key) { + case TOTAL_RESULTS_STR: + totalResults = BuilderFactory.LONG.build(kv.getValue()); + break; + case RESULTS_STR: + List> resList = (List>) kv.getValue(); + results = new ArrayList<>(resList.size()); + for (List rikv : resList) { + for (KeyValue ikv : rikv) { + if (FIELDS_STR.equals(BuilderFactory.STRING.build(ikv.getKey()))) { + results.add(BuilderFactory.ENCODED_OBJECT_MAP.build(ikv.getValue())); + break; + } + } + } + break; + } + } + return new AggregationResult(totalResults, results); + } + + list = (List) SafeEncoder.encodeObject(data); + + // the first element is always the number of results + long totalResults = (Long) list.get(0); + List> results = new ArrayList<>(list.size() - 1); + + for (int i = 1; i < list.size(); i++) { + List mapList = (List) list.get(i); + Map map = new HashMap<>(mapList.size() / 2, 1f); + for (int j = 0; j < mapList.size(); j += 2) { + Object r = mapList.get(j); + if (r instanceof JedisDataException) { + throw (JedisDataException) r; + } + map.put((String) r, mapList.get(j + 1)); + } + results.add(map); + } + return new AggregationResult(totalResults, results); + } + }; + + public static final Builder SEARCH_AGGREGATION_RESULT_WITH_CURSOR = new Builder() { + @Override + public AggregationResult build(Object data) { + List list = (List) data; + // return new AggregationResult(list.get(0), (long) list.get(1)); + AggregationResult r = SEARCH_AGGREGATION_RESULT.build(list.get(0)); + r.setCursorId((Long) list.get(1)); + return r; + } + }; } diff --git a/src/main/java/redis/clients/jedis/search/aggr/FtAggregateIteration.java b/src/main/java/redis/clients/jedis/search/aggr/FtAggregateIteration.java index f35100af09..931834ed49 100644 --- a/src/main/java/redis/clients/jedis/search/aggr/FtAggregateIteration.java +++ b/src/main/java/redis/clients/jedis/search/aggr/FtAggregateIteration.java @@ -4,7 +4,6 @@ import redis.clients.jedis.CommandArguments; import redis.clients.jedis.providers.ConnectionProvider; -import redis.clients.jedis.search.SearchBuilderFactory; import redis.clients.jedis.search.SearchProtocol; import redis.clients.jedis.util.JedisCommandIterationBase; @@ -20,7 +19,7 @@ public class FtAggregateIteration extends JedisCommandIterationBase getOwnArgs(); public final void addArgs(List args) { diff --git a/src/main/java/redis/clients/jedis/search/querybuilder/Node.java b/src/main/java/redis/clients/jedis/search/querybuilder/Node.java index 013ac79b6f..12e71e5d69 100644 --- a/src/main/java/redis/clients/jedis/search/querybuilder/Node.java +++ b/src/main/java/redis/clients/jedis/search/querybuilder/Node.java @@ -18,7 +18,7 @@ enum Parenthesize { /** * Never encapsulate. Note that this may be ignored if parentheses are semantically required - * (e.g. {@code @foo:(val1|val2)}. However something like {@code @foo:v1 @bar:v2} need not be + * (e.g. {@code @foo:(val1|val2)}. However, something like {@code @foo:v1 @bar:v2} need not be * parenthesized. */ diff --git a/src/main/java/redis/clients/jedis/search/schemafields/GeoShapeField.java b/src/main/java/redis/clients/jedis/search/schemafields/GeoShapeField.java new file mode 100644 index 0000000000..dd3b45e59e --- /dev/null +++ b/src/main/java/redis/clients/jedis/search/schemafields/GeoShapeField.java @@ -0,0 +1,49 @@ +package redis.clients.jedis.search.schemafields; + +import static redis.clients.jedis.search.SearchProtocol.SearchKeyword.GEOSHAPE; + +import redis.clients.jedis.CommandArguments; +import redis.clients.jedis.search.FieldName; + +public class GeoShapeField extends SchemaField { + + public enum CoordinateSystem { + + /** + * For cartesian (X,Y). + */ + FLAT, + + /** + * For geographic (lon, lat). + */ + SPHERICAL + } + + private final CoordinateSystem system; + + public GeoShapeField(String fieldName, CoordinateSystem system) { + super(fieldName); + this.system = system; + } + + public GeoShapeField(FieldName fieldName, CoordinateSystem system) { + super(fieldName); + this.system = system; + } + + public static GeoShapeField of(String fieldName, CoordinateSystem system) { + return new GeoShapeField(fieldName, system); + } + + @Override + public GeoShapeField as(String attribute) { + super.as(attribute); + return this; + } + + @Override + public void addParams(CommandArguments args) { + args.addParams(fieldName).add(GEOSHAPE).add(system); + } +} diff --git a/src/main/java/redis/clients/jedis/search/schemafields/SchemaField.java b/src/main/java/redis/clients/jedis/search/schemafields/SchemaField.java index 473baea472..8678780da2 100644 --- a/src/main/java/redis/clients/jedis/search/schemafields/SchemaField.java +++ b/src/main/java/redis/clients/jedis/search/schemafields/SchemaField.java @@ -19,4 +19,12 @@ public SchemaField as(String attribute) { fieldName.as(attribute); return this; } + + public final FieldName getFieldName() { + return fieldName; + } + + public final String getName() { + return fieldName.getName(); + } } diff --git a/src/main/java/redis/clients/jedis/search/schemafields/TagField.java b/src/main/java/redis/clients/jedis/search/schemafields/TagField.java index 044f9d75f6..407c4dbddc 100644 --- a/src/main/java/redis/clients/jedis/search/schemafields/TagField.java +++ b/src/main/java/redis/clients/jedis/search/schemafields/TagField.java @@ -106,6 +106,14 @@ public void addParams(CommandArguments args) { args.add(SEPARATOR).add(separator); } + if (caseSensitive) { + args.add(CASESENSITIVE); + } + + if (withSuffixTrie) { + args.add(WITHSUFFIXTRIE); + } + if (sortableUNF) { args.add(SORTABLE).add(UNF); } else if (sortable) { @@ -115,13 +123,5 @@ public void addParams(CommandArguments args) { if (noIndex) { args.add(NOINDEX); } - - if (caseSensitive) { - args.add(CASESENSITIVE); - } - - if (withSuffixTrie) { - args.add(WITHSUFFIXTRIE); - } } } diff --git a/src/main/java/redis/clients/jedis/search/schemafields/TextField.java b/src/main/java/redis/clients/jedis/search/schemafields/TextField.java index f7967383c7..573cae90a3 100644 --- a/src/main/java/redis/clients/jedis/search/schemafields/TextField.java +++ b/src/main/java/redis/clients/jedis/search/schemafields/TextField.java @@ -107,29 +107,30 @@ public void addParams(CommandArguments args) { args.addParams(fieldName); args.add(TEXT); - if (sortableUNF) { - args.add(SORTABLE).add(UNF); - } else if (sortable) { - args.add(SORTABLE); + if (weight != null) { + args.add(WEIGHT).add(weight); } if (noStem) { args.add(NOSTEM); } - if (noIndex) { - args.add(NOINDEX); - } if (phoneticMatcher != null) { args.add(PHONETIC).add(phoneticMatcher); } - if (weight != null) { - args.add(WEIGHT).add(weight); - } - if (withSuffixTrie) { args.add(WITHSUFFIXTRIE); } + + if (sortableUNF) { + args.add(SORTABLE).add(UNF); + } else if (sortable) { + args.add(SORTABLE); + } + + if (noIndex) { + args.add(NOINDEX); + } } } diff --git a/src/main/java/redis/clients/jedis/util/JedisMetaInfo.java b/src/main/java/redis/clients/jedis/util/JedisMetaInfo.java deleted file mode 100644 index c8c6566c4a..0000000000 --- a/src/main/java/redis/clients/jedis/util/JedisMetaInfo.java +++ /dev/null @@ -1,46 +0,0 @@ -package redis.clients.jedis.util; - -import java.io.InputStream; -import java.util.Properties; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Jedis Meta info load version groupId - */ -public class JedisMetaInfo { - private static final Logger log = LoggerFactory.getLogger(JedisMetaInfo.class); - - private static String groupId; - private static String artifactId; - private static String version; - - static { - Properties p = new Properties(); - try { - InputStream in = JedisMetaInfo.class.getClassLoader().getResourceAsStream("pom.properties"); - p.load(in); - - groupId = p.getProperty("groupId", null); - artifactId = p.getProperty("artifactId", null); - version = p.getProperty("version", null); - - in.close(); - } catch (Exception e) { - log.error("Load Jedis meta info from pom.properties failed", e); - } - } - - public static String getGroupId() { - return groupId; - } - - public static String getArtifactId() { - return artifactId; - } - - public static String getVersion() { - return version; - } -} diff --git a/src/main/java/redis/clients/jedis/util/RedisInputStream.java b/src/main/java/redis/clients/jedis/util/RedisInputStream.java index 57734cffdb..a0dad9d437 100644 --- a/src/main/java/redis/clients/jedis/util/RedisInputStream.java +++ b/src/main/java/redis/clients/jedis/util/RedisInputStream.java @@ -128,7 +128,7 @@ public byte[] readLineBytes() { /** * Slow path in case a line of bytes cannot be read in one #fill() operation. This is still faster - * than creating the StrinbBuilder, String, then encoding as byte[] in Protocol, then decoding + * than creating the StringBuilder, String, then encoding as byte[] in Protocol, then decoding * back into a String. */ private byte[] readLineBytesSlowly() { @@ -236,7 +236,7 @@ public int read(byte[] b, int off, int len) throws JedisConnectionException { } /** - * This methods assumes there are required bytes to be read. If we cannot read anymore bytes an + * This method assumes there are required bytes to be read. If we cannot read anymore bytes an * exception is thrown to quickly ascertain that the stream was smaller than expected. */ private void ensureFill() throws JedisConnectionException { diff --git a/src/main/resources/pom.properties b/src/main/resources/redis/clients/jedis/pom.properties similarity index 100% rename from src/main/resources/pom.properties rename to src/main/resources/redis/clients/jedis/pom.properties diff --git a/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java b/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java index 61f2737cf6..36474e12d5 100644 --- a/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java +++ b/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java @@ -60,7 +60,7 @@ public void checkResourceIsClosableAndReusable() { config.setBlockWhenExhausted(false); try (JedisPool pool = new JedisPool(config, hnp.getHost(), hnp.getPort(), Protocol.DEFAULT_TIMEOUT, Protocol.DEFAULT_TIMEOUT, 0 /* infinite */, "acljedis", - "fizzbuzz", Protocol.DEFAULT_DATABASE, "closable-resuable-pool", false, null, null, null)) { + "fizzbuzz", Protocol.DEFAULT_DATABASE, "closable-reusable-pool", false, null, null, null)) { Jedis jedis = pool.getResource(); jedis.set("hello", "jedis"); @@ -79,7 +79,7 @@ public void checkResourceWithConfigIsClosableAndReusable() { config.setMaxTotal(1); config.setBlockWhenExhausted(false); try (JedisPool pool = new JedisPool(config, hnp, DefaultJedisClientConfig.builder() - .user("acljedis").password("fizzbuzz").clientName("closable-resuable-pool") + .user("acljedis").password("fizzbuzz").clientName("closable-reusable-pool") .build())) { Jedis jedis = pool.getResource(); @@ -89,7 +89,7 @@ public void checkResourceWithConfigIsClosableAndReusable() { Jedis jedis2 = pool.getResource(); assertEquals(jedis, jedis2); assertEquals("jedis", jedis2.get("hello")); - assertEquals("closable-resuable-pool", jedis2.clientGetname()); + assertEquals("closable-reusable-pool", jedis2.clientGetname()); jedis2.close(); } } diff --git a/src/test/java/redis/clients/jedis/ConnectionTest.java b/src/test/java/redis/clients/jedis/ConnectionTest.java index ee9a0a9742..28eba8100c 100644 --- a/src/test/java/redis/clients/jedis/ConnectionTest.java +++ b/src/test/java/redis/clients/jedis/ConnectionTest.java @@ -17,7 +17,7 @@ public void tearDown() throws Exception { } @Test(expected = JedisConnectionException.class) - public void checkUnkownHost() { + public void checkUnknownHost() { client = new Connection("someunknownhost", Protocol.DEFAULT_PORT); client.connect(); } diff --git a/src/test/java/redis/clients/jedis/JedisClusterTest.java b/src/test/java/redis/clients/jedis/JedisClusterTest.java index b93fa2409e..8297eb90c6 100644 --- a/src/test/java/redis/clients/jedis/JedisClusterTest.java +++ b/src/test/java/redis/clients/jedis/JedisClusterTest.java @@ -741,6 +741,65 @@ public void clusterRefreshNodes() throws Exception { } } + @Test(timeout = 30_000) + public void clusterPeriodTopologyRefreshTest() throws Exception { + Set jedisClusterNode = new HashSet<>(); + jedisClusterNode.add(nodeInfo1); + jedisClusterNode.add(nodeInfo2); + jedisClusterNode.add(nodeInfo3); + + // we set topologyRefreshPeriod is 1s + Duration topologyRefreshPeriod = Duration.ofSeconds(1); + try (JedisCluster cluster = new JedisCluster(jedisClusterNode, DEFAULT_CLIENT_CONFIG, DEFAULT_POOL_CONFIG, + topologyRefreshPeriod, DEFAULT_REDIRECTIONS, Duration.ofSeconds(10))) { + assertEquals(3, cluster.getClusterNodes().size()); + cleanUp(); // cleanup and add node4 + + // at first, join node4 to cluster + node1.clusterMeet(LOCAL_IP, nodeInfo2.getPort()); + node1.clusterMeet(LOCAL_IP, nodeInfo3.getPort()); + node1.clusterMeet(LOCAL_IP, nodeInfo4.getPort()); + // split available slots across the three nodes + int slotsPerNode = CLUSTER_HASHSLOTS / 4; + int[] node1Slots = new int[slotsPerNode]; + int[] node2Slots = new int[slotsPerNode]; + int[] node3Slots = new int[slotsPerNode]; + int[] node4Slots = new int[slotsPerNode]; + for (int i = 0, slot1 = 0, slot2 = 0, slot3 = 0, slot4 = 0; i < CLUSTER_HASHSLOTS; i++) { + if (i < slotsPerNode) { + node1Slots[slot1++] = i; + } else if (i >= slotsPerNode && i < slotsPerNode*2) { + node2Slots[slot2++] = i; + } else if (i >= slotsPerNode*2 && i < slotsPerNode*3) { + node3Slots[slot3++] = i; + } else { + node4Slots[slot4++] = i; + } + } + + node1.clusterAddSlots(node1Slots); + node2.clusterAddSlots(node2Slots); + node3.clusterAddSlots(node3Slots); + node4.clusterAddSlots(node4Slots); + JedisClusterTestUtil.waitForClusterReady(node1, node2, node3, node4); + + // Now we just wait topologyRefreshPeriod * 3 (executor will delay) for cluster topology refresh (3 -> 4) + Thread.sleep(topologyRefreshPeriod.toMillis() * 3); + + assertEquals(4, cluster.getClusterNodes().size()); + String nodeKey4 = LOCAL_IP + ":" + nodeInfo4.getPort(); + assertTrue(cluster.getClusterNodes().keySet().contains(nodeKey4)); + + // make 4 nodes to 3 nodes + cleanUp(); + setUp(); + + // Now we just wait topologyRefreshPeriod * 3 (executor will delay) for cluster topology refresh (4 -> 3) + Thread.sleep(topologyRefreshPeriod.toMillis() * 3); + assertEquals(3, cluster.getClusterNodes().size()); + } + } + private static String getNodeServingSlotRange(String infoOutput) { // f4f3dc4befda352a4e0beccf29f5e8828438705d 127.0.0.1:7380 master - 0 // 1394372400827 0 connected 5461-10922 diff --git a/src/test/java/redis/clients/jedis/JedisClusterTestBase.java b/src/test/java/redis/clients/jedis/JedisClusterTestBase.java index 6094575a54..0746c2d37c 100644 --- a/src/test/java/redis/clients/jedis/JedisClusterTestBase.java +++ b/src/test/java/redis/clients/jedis/JedisClusterTestBase.java @@ -77,10 +77,10 @@ protected void cleanUp() { node2.flushDB(); node3.flushDB(); node4.flushDB(); - node1.clusterReset(ClusterResetType.SOFT); - node2.clusterReset(ClusterResetType.SOFT); - node3.clusterReset(ClusterResetType.SOFT); - node4.clusterReset(ClusterResetType.SOFT); + node1.clusterReset(ClusterResetType.HARD); + node2.clusterReset(ClusterResetType.HARD); + node3.clusterReset(ClusterResetType.HARD); + node4.clusterReset(ClusterResetType.HARD); } @After diff --git a/src/test/java/redis/clients/jedis/JedisPoolTest.java b/src/test/java/redis/clients/jedis/JedisPoolTest.java index 18e448c52e..a256abcae0 100644 --- a/src/test/java/redis/clients/jedis/JedisPoolTest.java +++ b/src/test/java/redis/clients/jedis/JedisPoolTest.java @@ -79,7 +79,7 @@ public void checkResourceIsClosableAndReusable() { config.setMaxTotal(1); config.setBlockWhenExhausted(false); try (JedisPool pool = new JedisPool(config, hnp.getHost(), hnp.getPort(), 2000, "foobared", 0, - "closable-resuable-pool", false, null, null, null)) { + "closable-reusable-pool", false, null, null, null)) { Jedis jedis = pool.getResource(); jedis.set("hello", "jedis"); diff --git a/src/test/java/redis/clients/jedis/JedisPooledTest.java b/src/test/java/redis/clients/jedis/JedisPooledTest.java index cdae9a5965..6036062f5b 100644 --- a/src/test/java/redis/clients/jedis/JedisPooledTest.java +++ b/src/test/java/redis/clients/jedis/JedisPooledTest.java @@ -1,10 +1,10 @@ package redis.clients.jedis; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.anything; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -22,6 +22,7 @@ public class JedisPooledTest { private static final HostAndPort hnp = HostAndPorts.getRedisServers().get(7); + private static final HostAndPort pwp = HostAndPorts.getRedisServers().get(1); // password protected @Test public void checkCloseableConnections() { @@ -177,9 +178,8 @@ public void testResetValidCredentials() { DefaultRedisCredentialsProvider credentialsProvider = new DefaultRedisCredentialsProvider(new DefaultRedisCredentials(null, "bad password")); - try (JedisPooled pool = new JedisPooled(HostAndPorts.getRedisServers().get(0), - DefaultJedisClientConfig.builder().credentialsProvider(credentialsProvider) - .clientName("my_shiny_client_name").build())) { + try (JedisPooled pool = new JedisPooled(pwp, DefaultJedisClientConfig.builder() + .credentialsProvider(credentialsProvider).build())) { try { pool.get("foo"); fail("Should not get resource from pool"); @@ -187,7 +187,7 @@ public void testResetValidCredentials() { assertEquals(0, pool.getPool().getNumActive()); credentialsProvider.setCredentials(new DefaultRedisCredentials(null, "foobared")); - assertNull(pool.get("foo")); + assertThat(pool.get("foo"), anything()); } } @@ -238,9 +238,8 @@ public void cleanUp() { GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); poolConfig.setMaxTotal(1); poolConfig.setTestOnBorrow(true); - try (JedisPooled pool = new JedisPooled(HostAndPorts.getRedisServers().get(0), - DefaultJedisClientConfig.builder().credentialsProvider(credentialsProvider) - .build(), poolConfig)) { + try (JedisPooled pool = new JedisPooled(pwp, DefaultJedisClientConfig.builder() + .credentialsProvider(credentialsProvider).build(), poolConfig)) { try { pool.get("foo"); fail("Should not get resource from pool"); @@ -251,7 +250,7 @@ public void cleanUp() { assertThat(cleanupCount.getAndSet(0), greaterThanOrEqualTo(1)); validPassword.set(true); - assertNull(pool.get("foo")); + assertThat(pool.get("foo"), anything()); assertThat(prepareCount.get(), equalTo(1)); assertThat(cleanupCount.get(), equalTo(1)); } diff --git a/src/test/java/redis/clients/jedis/JedisTest.java b/src/test/java/redis/clients/jedis/JedisTest.java index df56ea4fb2..e9520ff394 100644 --- a/src/test/java/redis/clients/jedis/JedisTest.java +++ b/src/test/java/redis/clients/jedis/JedisTest.java @@ -288,4 +288,39 @@ public void checkDisconnectOnQuit() { assertFalse(jedis.isConnected()); } + @Test + public void clientSetInfoDefault() { + try (Jedis jedis = new Jedis(hnp, DefaultJedisClientConfig.builder().password("foobared") + .clientSetInfoConfig(ClientSetInfoConfig.DEFAULT).build())) { + assertEquals("PONG", jedis.ping()); + String info = jedis.clientInfo(); + assertTrue(info.contains("lib-name=" + JedisMetaInfo.getArtifactId())); + assertTrue(info.contains("lib-ver=" + JedisMetaInfo.getVersion())); + } + } + + @Test + public void clientSetInfoDisabled() { + try (Jedis jedis = new Jedis(hnp, DefaultJedisClientConfig.builder().password("foobared") + .clientSetInfoConfig(ClientSetInfoConfig.DISABLED).build())) { + assertEquals("PONG", jedis.ping()); + String info = jedis.clientInfo(); + assertFalse(info.contains("lib-name=" + JedisMetaInfo.getArtifactId())); + assertFalse(info.contains("lib-ver=" + JedisMetaInfo.getVersion())); + } + } + + @Test + public void clientSetInfoLibNameSuffix() { + final String libNameSuffix = "for-redis"; + ClientSetInfoConfig setInfoConfig = ClientSetInfoConfig.withLibNameSuffix(libNameSuffix); + try (Jedis jedis = new Jedis(hnp, DefaultJedisClientConfig.builder().password("foobared") + .clientSetInfoConfig(setInfoConfig).build())) { + assertEquals("PONG", jedis.ping()); + String info = jedis.clientInfo(); + assertTrue(info.contains("lib-name=" + JedisMetaInfo.getArtifactId() + '(' + libNameSuffix + ')')); + assertTrue(info.contains("lib-ver=" + JedisMetaInfo.getVersion())); + } + } + } diff --git a/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java index fc3f4c9c3e..a681d4f4d8 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java @@ -21,6 +21,7 @@ import redis.clients.jedis.HostAndPort; import redis.clients.jedis.Jedis; +import redis.clients.jedis.Transaction; import redis.clients.jedis.args.ExpiryOption; import redis.clients.jedis.params.ScanParams; import redis.clients.jedis.resps.ScanResult; @@ -1124,4 +1125,32 @@ public void copy() { assertTrue(jedis.copy(bfoo1, bfoo2, true)); assertArrayEquals(bbar1, jedis.get(bfoo2)); } + + @Test + public void reset() { + // response test + String status = jedis.reset(); + assertEquals("RESET", status); + + // auth reset + String counter = "counter"; + Exception ex1 = assertThrows(JedisDataException.class, () -> { + jedis.set(counter, "1"); + }); + assertEquals("NOAUTH Authentication required.", ex1.getMessage()); + + // multi reset + jedis.auth("foobared"); + jedis.set(counter, "1"); + + Transaction trans = jedis.multi(); + trans.incr(counter); + jedis.reset(); + + Exception ex2 = assertThrows(JedisDataException.class, trans::exec); + assertEquals("EXECABORT Transaction discarded because of: NOAUTH Authentication required.", ex2.getMessage()); + + jedis.auth("foobared"); + assertEquals("1", jedis.get(counter)); + } } diff --git a/src/test/java/redis/clients/jedis/commands/jedis/ClientCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/ClientCommandsTest.java index cbe04a5503..8c3f35db49 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/ClientCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/ClientCommandsTest.java @@ -64,14 +64,14 @@ public void nameBinary() { } @Test - public void clientSetInfoDefault() { - String libName = "jedis"; + public void clientSetInfoCommand() { + String libName = "Jedis::A-Redis-Java-library"; String libVersion = "999.999.999"; assertEquals("OK", client.clientSetInfo(ClientAttributeOption.LIB_NAME, libName)); assertEquals("OK", client.clientSetInfo(ClientAttributeOption.LIB_VER, libVersion)); String info = client.clientInfo(); - assertTrue(info.contains("lib-name=jedis")); - assertTrue(info.contains("lib-ver=999.999.999")); + assertTrue(info.contains("lib-name=" + libName)); + assertTrue(info.contains("lib-ver=" + libVersion)); } @Test diff --git a/src/test/java/redis/clients/jedis/commands/jedis/ClusterCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/ClusterCommandsTest.java index a6654b47ca..7e5c5db875 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/ClusterCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/ClusterCommandsTest.java @@ -3,6 +3,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.List; @@ -13,6 +14,7 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import redis.clients.jedis.HostAndPort; @@ -20,6 +22,8 @@ import redis.clients.jedis.args.ClusterResetType; import redis.clients.jedis.HostAndPorts; import redis.clients.jedis.exceptions.JedisDataException; +import redis.clients.jedis.resps.ClusterShardInfo; +import redis.clients.jedis.resps.ClusterShardNodeInfo; import redis.clients.jedis.util.JedisClusterCRC16; import redis.clients.jedis.util.JedisClusterTestUtil; @@ -48,8 +52,17 @@ public void tearDown() { node2.disconnect(); } + @BeforeClass + public static void resetRedisBefore() { + removeSlots(); + } + @AfterClass - public static void removeSlots() throws InterruptedException { + public static void resetRedisAfter() { + removeSlots(); + } + + public static void removeSlots() { try (Jedis node = new Jedis(nodeInfo1)) { node.auth("cluster"); node.clusterReset(ClusterResetType.SOFT); @@ -189,6 +202,37 @@ public void clusterSlots() { node1.clusterDelSlots(3000, 3001, 3002); } + @Test + public void clusterShards() { + assertEquals("OK", node1.clusterAddSlots(3100, 3101, 3102, 3105)); + + List shards = node1.clusterShards(); + assertNotNull(shards); + assertTrue(shards.size() > 0); + + for (ClusterShardInfo shardInfo : shards) { + assertNotNull(shardInfo); + + assertTrue(shardInfo.getSlots().size() > 1); + for (List slotRange : shardInfo.getSlots()) { + assertEquals(2, slotRange.size()); + } + + for (ClusterShardNodeInfo nodeInfo : shardInfo.getNodes()) { + assertNotNull(nodeInfo.getId()); + assertNotNull(nodeInfo.getEndpoint()); + assertNotNull(nodeInfo.getIp()); + assertNull(nodeInfo.getHostname()); + assertNotNull(nodeInfo.getPort()); + assertNull(nodeInfo.getTlsPort()); + assertNotNull(nodeInfo.getRole()); + assertNotNull(nodeInfo.getReplicationOffset()); + assertNotNull(nodeInfo.getHealth()); + } + } + node1.clusterDelSlots(3100, 3101, 3102, 3105); + } + @Test public void clusterLinks() throws InterruptedException { List> links = node1.clusterLinks(); @@ -238,4 +282,4 @@ public void ClusterBumpEpoch() { MatcherAssert.assertThat(node1.clusterBumpEpoch(), Matchers.matchesPattern("^BUMPED|STILL [0-9]+$")); } -} \ No newline at end of file +} diff --git a/src/test/java/redis/clients/jedis/commands/jedis/ClusterScriptingCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/ClusterScriptingCommandsTest.java index a2304bc38c..503337683e 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/ClusterScriptingCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/ClusterScriptingCommandsTest.java @@ -1,6 +1,8 @@ package redis.clients.jedis.commands.jedis; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.util.ArrayList; @@ -8,10 +10,11 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.function.Supplier; import org.junit.Test; +import redis.clients.jedis.HostAndPort; import redis.clients.jedis.args.FlushMode; +import redis.clients.jedis.exceptions.JedisBroadcastException; import redis.clients.jedis.exceptions.JedisClusterOperationException; import redis.clients.jedis.exceptions.JedisDataException; @@ -110,4 +113,17 @@ public void broadcast() { assertEquals(Arrays.asList(false, false), cluster.scriptExists(Arrays.asList(sha1_1, sha1_2))); } + + @Test + public void broadcastWithError() { + + JedisBroadcastException error = assertThrows(JedisBroadcastException.class, () -> cluster.functionDelete("xyz")); + + Map replies = error.getReplies(); + assertEquals(3, replies.size()); + replies.values().forEach(r -> { + assertSame(JedisDataException.class, r.getClass()); + assertEquals("ERR Library not found", ((JedisDataException) r).getMessage()); + }); + } } diff --git a/src/test/java/redis/clients/jedis/commands/unified/pooled/PooledPipeliningTest.java b/src/test/java/redis/clients/jedis/commands/unified/pooled/PooledMiscellaneousTest.java similarity index 73% rename from src/test/java/redis/clients/jedis/commands/unified/pooled/PooledPipeliningTest.java rename to src/test/java/redis/clients/jedis/commands/unified/pooled/PooledMiscellaneousTest.java index da2c3f8846..fc917e4e47 100644 --- a/src/test/java/redis/clients/jedis/commands/unified/pooled/PooledPipeliningTest.java +++ b/src/test/java/redis/clients/jedis/commands/unified/pooled/PooledMiscellaneousTest.java @@ -1,6 +1,7 @@ package redis.clients.jedis.commands.unified.pooled; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import java.util.ArrayList; import java.util.Arrays; @@ -14,14 +15,14 @@ import redis.clients.jedis.JedisPooled; import redis.clients.jedis.Pipeline; import redis.clients.jedis.Response; -import redis.clients.jedis.Transaction; - +import redis.clients.jedis.AbstractTransaction; import redis.clients.jedis.commands.unified.UnifiedJedisCommandsTestBase; +import redis.clients.jedis.exceptions.JedisDataException; -public class PooledPipeliningTest extends UnifiedJedisCommandsTestBase { +public class PooledMiscellaneousTest extends UnifiedJedisCommandsTestBase { protected Pipeline pipeline; - protected Transaction transaction; + protected AbstractTransaction transaction; @BeforeClass public static void prepare() throws InterruptedException { @@ -47,7 +48,7 @@ public void tearDown() { } @Test - public void simple() { + public void pipeline() { final int count = 10; int totalCount = 0; for (int i = 0; i < count; i++) { @@ -104,4 +105,27 @@ public void transaction() { assertEquals(expected.get(i), responses.get(i)); } } + + @Test + public void broadcast() { + + String script_1 = "return 'jedis'"; + String sha1_1 = jedis.scriptLoad(script_1); + + String script_2 = "return 79"; + String sha1_2 = jedis.scriptLoad(script_2); + + assertEquals(Arrays.asList(true, true), jedis.scriptExists(Arrays.asList(sha1_1, sha1_2))); + + jedis.scriptFlush(); + + assertEquals(Arrays.asList(false, false), jedis.scriptExists(Arrays.asList(sha1_1, sha1_2))); + } + + @Test + public void broadcastWithError() { + JedisDataException error = assertThrows(JedisDataException.class, + () -> jedis.functionDelete("xyz")); + assertEquals("ERR Library not found", error.getMessage()); + } } diff --git a/src/test/java/redis/clients/jedis/examples/GeoShapeFieldsUsageInRediSearch.java b/src/test/java/redis/clients/jedis/examples/GeoShapeFieldsUsageInRediSearch.java new file mode 100644 index 0000000000..fd309def50 --- /dev/null +++ b/src/test/java/redis/clients/jedis/examples/GeoShapeFieldsUsageInRediSearch.java @@ -0,0 +1,107 @@ +package redis.clients.jedis.examples; + +import java.util.Collections; +import org.junit.Assert; + +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.Polygon; +import org.locationtech.jts.io.ParseException; +import org.locationtech.jts.io.WKTReader; + +import redis.clients.jedis.HostAndPort; +import redis.clients.jedis.JedisPooled; +import redis.clients.jedis.UnifiedJedis; +import redis.clients.jedis.search.FTSearchParams; +import redis.clients.jedis.search.RediSearchUtil; +import redis.clients.jedis.search.SearchResult; +import redis.clients.jedis.search.schemafields.GeoShapeField; + +/** + * As of RediSearch 2.8.4, advanced GEO querying with GEOSHAPE fields is supported. + * + * Any object/library producing a + * well-known + * text (WKT) in {@code toString()} method can be used. + * + * This example uses the JTS library. + *
+ * {@code
+ * 
+ *   org.locationtech.jts
+ *   jts-core
+ *   1.19.0
+ * 
+ * }
+ * 
+ */ +public class GeoShapeFieldsUsageInRediSearch { + + public static void main(String[] args) { + + // We'll create geometry objects with GeometryFactory + final GeometryFactory factory = new GeometryFactory(); + + final String host = "localhost"; + final int port = 6379; + final HostAndPort address = new HostAndPort(host, port); + + UnifiedJedis client = new JedisPooled(address); + // client.setDefaultSearchDialect(3); // we can set default search dialect for the client (UnifiedJedis) object + // to avoid setting dialect in every query. + + // creating index + client.ftCreate("geometry-index", + GeoShapeField.of("geometry", GeoShapeField.CoordinateSystem.SPHERICAL) // 'SPHERICAL' is for geographic (lon, lat). + // 'FLAT' coordinate system also available for cartesian (X,Y). + ); + + // preparing data + final Polygon small = factory.createPolygon( + new Coordinate[]{new Coordinate(34.9001, 29.7001), + new Coordinate(34.9001, 29.7100), new Coordinate(34.9100, 29.7100), + new Coordinate(34.9100, 29.7001), new Coordinate(34.9001, 29.7001)} + ); + + // client.hset("small", RediSearchUtil.toStringMap(Collections.singletonMap("geometry", small))); // setting data + client.hset("small", "geometry", small.toString()); // simplified setting data + + final Polygon large = factory.createPolygon( + new Coordinate[]{new Coordinate(34.9001, 29.7001), + new Coordinate(34.9001, 29.7200), new Coordinate(34.9200, 29.7200), + new Coordinate(34.9200, 29.7001), new Coordinate(34.9001, 29.7001)} + ); + + // client.hset("large", RediSearchUtil.toStringMap(Collections.singletonMap("geometry", large))); // setting data + client.hset("large", "geometry", large.toString()); // simplified setting data + + // searching + final Polygon within = factory.createPolygon( + new Coordinate[]{new Coordinate(34.9000, 29.7000), + new Coordinate(34.9000, 29.7150), new Coordinate(34.9150, 29.7150), + new Coordinate(34.9150, 29.7000), new Coordinate(34.9000, 29.7000)} + ); + + SearchResult res = client.ftSearch("geometry-index", + "@geometry:[within $poly]", // querying 'within' condition. + // RediSearch also supports 'contains' condition. + FTSearchParams.searchParams() + .addParam("poly", within) + .dialect(3) // DIALECT '3' is required for this query + ); + Assert.assertEquals(1, res.getTotalResults()); + Assert.assertEquals(1, res.getDocuments().size()); + + // We can parse geometry objects with WKTReader + try { + final WKTReader reader = new WKTReader(); + Geometry object = reader.read(res.getDocuments().get(0).getString("geometry")); + Assert.assertEquals(small, object); + } catch (ParseException ex) { + ex.printStackTrace(System.err); + } + } + + // Note: As of RediSearch 2.8.4, only POLYGON and POINT objects are supported. +} diff --git a/src/test/java/redis/clients/jedis/exceptions/ExceptionsTest.java b/src/test/java/redis/clients/jedis/exceptions/ExceptionsTest.java index 9bdd77371b..4b1bef38fe 100644 --- a/src/test/java/redis/clients/jedis/exceptions/ExceptionsTest.java +++ b/src/test/java/redis/clients/jedis/exceptions/ExceptionsTest.java @@ -19,33 +19,6 @@ public static void prepare() { CAUSE = new Throwable("This is a test cause."); } - @Test - public void abortedTransaction() { - try { - throw new AbortedTransactionException(MESSAGE); - } catch (Exception e) { - assertSame(AbortedTransactionException.class, e.getClass()); - assertEquals(MESSAGE, e.getMessage()); - assertNull(e.getCause()); - } - - try { - throw new AbortedTransactionException(CAUSE); - } catch (Exception e) { - assertSame(AbortedTransactionException.class, e.getClass()); - assertEquals(CAUSE, e.getCause()); - assertEquals(CAUSE.toString(), e.getMessage()); - } - - try { - throw new AbortedTransactionException(MESSAGE, CAUSE); - } catch (Exception e) { - assertSame(AbortedTransactionException.class, e.getClass()); - assertEquals(MESSAGE, e.getMessage()); - assertEquals(CAUSE, e.getCause()); - } - } - @Test public void invalidURI() { try { diff --git a/src/test/java/redis/clients/jedis/misc/AutomaticFailoverTest.java b/src/test/java/redis/clients/jedis/misc/AutomaticFailoverTest.java new file mode 100644 index 0000000000..4f8f896afc --- /dev/null +++ b/src/test/java/redis/clients/jedis/misc/AutomaticFailoverTest.java @@ -0,0 +1,84 @@ +package redis.clients.jedis.misc; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import redis.clients.jedis.AbstractPipeline; +import redis.clients.jedis.AbstractTransaction; +import redis.clients.jedis.DefaultJedisClientConfig; +import redis.clients.jedis.HostAndPort; +import redis.clients.jedis.HostAndPorts; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisClientConfig; +import redis.clients.jedis.MultiClusterClientConfig; +import redis.clients.jedis.UnifiedJedis; +import redis.clients.jedis.providers.MultiClusterPooledConnectionProvider; + +public class AutomaticFailoverTest { + + private final HostAndPort hostAndPort1 = HostAndPorts.getRedisServers().get(0); + private final HostAndPort hostAndPort2 = HostAndPorts.getRedisServers().get(1); + + private final JedisClientConfig clientConfig = DefaultJedisClientConfig.builder().password("foobared").build(); + + private Jedis jedis1; + private Jedis jedis2; + + private MultiClusterPooledConnectionProvider provider; + + @Before + public void setUp() { + + MultiClusterClientConfig.ClusterConfig[] clusterConfigs = new MultiClusterClientConfig.ClusterConfig[2]; + clusterConfigs[0] = new MultiClusterClientConfig.ClusterConfig(hostAndPort1, clientConfig); + clusterConfigs[1] = new MultiClusterClientConfig.ClusterConfig(hostAndPort2, clientConfig); + + provider = new MultiClusterPooledConnectionProvider(new MultiClusterClientConfig.Builder(clusterConfigs).build()); + + jedis1 = new Jedis(hostAndPort1, clientConfig); + jedis1.flushAll(); + jedis2 = new Jedis(hostAndPort2, clientConfig); + jedis2.flushAll(); + } + + @After + public void cleanUp() { + + provider.close(); + + jedis1.close(); + jedis2.close(); + } + + @Test + public void pipelineWithSwitch() { + try (UnifiedJedis client = new UnifiedJedis(provider)) { + AbstractPipeline pipe = client.pipelined(); + pipe.set("pstr", "foobar"); + pipe.hset("phash", "foo", "bar"); + provider.incrementActiveMultiClusterIndex(); + pipe.sync(); + } + + assertEquals("foobar", jedis2.get("pstr")); + assertEquals("bar", jedis2.hget("phash", "foo")); + } + + @Test + public void transactionWithSwitch() { + try (UnifiedJedis client = new UnifiedJedis(provider)) { + AbstractTransaction tx = client.multi(); + tx.set("tstr", "foobar"); + tx.hset("thash", "foo", "bar"); + provider.incrementActiveMultiClusterIndex(); + assertEquals(Arrays.asList("OK", Long.valueOf(1L)), tx.exec()); + } + + assertEquals("foobar", jedis2.get("tstr")); + assertEquals("bar", jedis2.hget("thash", "foo")); + } +} diff --git a/src/test/java/redis/clients/jedis/misc/ClientSetInfoConfigTest.java b/src/test/java/redis/clients/jedis/misc/ClientSetInfoConfigTest.java new file mode 100644 index 0000000000..8b85f70252 --- /dev/null +++ b/src/test/java/redis/clients/jedis/misc/ClientSetInfoConfigTest.java @@ -0,0 +1,26 @@ +package redis.clients.jedis.misc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +import java.util.Arrays; +import org.junit.Test; + +import redis.clients.jedis.ClientSetInfoConfig; +import redis.clients.jedis.exceptions.JedisValidationException; + +public class ClientSetInfoConfigTest { + + @Test + public void replaceSpacesWithHyphens() { + assertEquals("Redis-Java-client", + ClientSetInfoConfig.withLibNameSuffix("Redis Java client").getLibNameSuffix()); + } + + @Test + public void errorForBraces() { + Arrays.asList('(', ')', '[', ']', '{', '}') + .forEach(brace -> assertThrows(JedisValidationException.class, + () -> ClientSetInfoConfig.withLibNameSuffix("" + brace))); + } +} diff --git a/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java b/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java index ce184f5b5a..50b48854da 100644 --- a/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java +++ b/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java @@ -14,16 +14,19 @@ import java.util.Collections; import org.json.JSONArray; import org.json.JSONObject; +import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; import redis.clients.jedis.Pipeline; +import redis.clients.jedis.RedisProtocol; import redis.clients.jedis.Response; import redis.clients.jedis.json.JsonSetParams; import redis.clients.jedis.json.Path; import redis.clients.jedis.json.Path2; import redis.clients.jedis.search.*; import redis.clients.jedis.search.aggr.*; +import redis.clients.jedis.util.RedisProtocolUtil; public class RedisModulesPipelineTest extends RedisModuleCommandsTestBase { @@ -52,15 +55,15 @@ public void search() { p.hset("doc1", toStringMap(fields)); p.hset("doc2", toStringMap(fields)); Response searchResult = p.ftSearch(index, new Query("hello world")); - Response searchBytesResult = p.ftSearch(index.getBytes(), new Query("hello world")); +// Response searchBytesResult = p.ftSearch(index.getBytes(), new Query("hello world")); // not RESP3 supported Response aggregateResult = p.ftAggregate(index, new AggregationBuilder().groupBy("@title")); Response explain = p.ftExplain(index, new Query("@title:title_val")); Response> explainCLI = p.ftExplainCLI(index, new Query("@title:title_val")); Response> info = p.ftInfo(index); Response configSet = p.ftConfigSet("timeout", "100"); - Response> configGet = p.ftConfigGet("*"); + Response> configGet = p.ftConfigGet("*"); Response configSetIndex = p.ftConfigSet(index, "timeout", "100"); - Response> configGetIndex = p.ftConfigGet(index, "*"); + Response> configGetIndex = p.ftConfigGet(index, "*"); Response synUpdate = p.ftSynUpdate(index, "foo", "bar"); Response>> synDump = p.ftSynDump(index); @@ -71,7 +74,7 @@ public void search() { assertEquals("OK", alter.get()); assertEquals("OK", alter.get()); assertEquals(2, searchResult.get().getTotalResults()); - assertEquals(2, searchBytesResult.get().getTotalResults()); +// assertEquals(2, searchBytesResult.get().getTotalResults()); assertEquals(1, aggregateResult.get().getTotalResults()); assertNotNull(explain.get()); assertNotNull(explainCLI.get().get(0)); @@ -88,6 +91,8 @@ public void search() { @Test public void jsonV1() { + Assume.assumeFalse(RedisProtocolUtil.getRedisProtocol() == RedisProtocol.RESP3); + Map hm1 = new HashMap<>(); hm1.put("hello", "world"); hm1.put("oh", "snap"); diff --git a/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java b/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java index 1e6a38ed43..706d57ef82 100644 --- a/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java +++ b/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java @@ -1,10 +1,11 @@ package redis.clients.jedis.modules.bloom; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.Collections; -import java.util.TreeSet; +import java.util.Map; import org.junit.BeforeClass; import org.junit.Test; @@ -30,12 +31,20 @@ public void createTopKFilter() { assertEquals(Arrays.asList(true, false, true), client.topkQuery("aaa", "bb", "gg", "cc")); - assertEquals(new TreeSet<>(Arrays.asList("bb", "cc")), new TreeSet<>(client.topkList("aaa"))); + assertEquals(Arrays.asList("bb", "cc"), client.topkList("aaa")); -// assertEquals(null, client.topkIncrBy("aaa", "ff", 10)); - assertEquals(Collections.singletonList(null), - client.topkIncrBy("aaa", Collections.singletonMap("ff", 10L))); + Map listWithCount = client.topkListWithCount("aaa"); + assertEquals(2, listWithCount.size()); + listWithCount.forEach((item, count) -> { + assertTrue(Arrays.asList("bb", "cc").contains(item)); + assertEquals(Long.valueOf(1), count); + }); + + assertEquals(null, client.topkIncrBy("aaa", "ff", 5)); + assertEquals(Arrays.asList("ff", "bb", "cc"), client.topkList("aaa")); - assertEquals(new TreeSet<>(Arrays.asList("bb", "cc", "ff")), new TreeSet<>(client.topkList("aaa"))); + assertEquals(Collections.singletonList(null), + client.topkIncrBy("aaa", Collections.singletonMap("ff", 8L))); + assertEquals(Long.valueOf(13), client.topkListWithCount("aaa").get("ff")); } } diff --git a/src/test/java/redis/clients/jedis/modules/gears/GearsTest.java b/src/test/java/redis/clients/jedis/modules/gears/GearsTest.java new file mode 100644 index 0000000000..e4dc10a82d --- /dev/null +++ b/src/test/java/redis/clients/jedis/modules/gears/GearsTest.java @@ -0,0 +1,527 @@ +package redis.clients.jedis.modules.gears; + +import org.hamcrest.Matchers; +import org.junit.After; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import redis.clients.jedis.RedisProtocol; +import redis.clients.jedis.exceptions.JedisDataException; +import redis.clients.jedis.gears.TFunctionListParams; +import redis.clients.jedis.gears.TFunctionLoadParams; +import redis.clients.jedis.modules.RedisModuleCommandsTestBase; +import redis.clients.jedis.gears.resps.GearsLibraryInfo; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +public class GearsTest extends RedisModuleCommandsTestBase { + + private static final String BAD_FUNCTION = "All Your Base Are Belong to Us"; + + private static final String[] LIBRARIES_ARRAY = new String[]{ + "streamTriggers", "withFlags", "pingpong", "keyspaceTriggers", "hashitout", "withConfig"}; + + @BeforeClass + public static void prepare() { + RedisModuleCommandsTestBase.prepare(); + } + + @After + @Override + public void tearDown() throws Exception { + deleteFunctions(); // delete functions before closing connections + super.tearDown(); + } + + protected void deleteFunctions() { + List libraries = client.tFunctionList(); + libraries.stream().map(GearsLibraryInfo::getName).forEach(library -> client.tFunctionDelete(library)); + } + + @Test + public void testFunctionLoad() throws IOException { + client.tFunctionLoad(readLibrary("pingpong.js")); + + List libraries = client.tFunctionList(); + assertEquals(Collections.singletonList("pingpong"), + libraries.stream().map(GearsLibraryInfo::getName).collect(Collectors.toList())); + } + + @Test(expected = JedisDataException.class) + public void testFunctionLoadAlreadyLoadedFails() throws IOException { + client.tFunctionLoad(readLibrary("pingpong.js")); + client.tFunctionLoad(readLibrary("pingpong.js")); + } + + @Test + public void testFunctionLoadWithReplace() throws IOException { + client.tFunctionLoad(readLibrary("pingpong.js")); + client.tFunctionLoad(readLibrary("pingpong.js"), TFunctionLoadParams.loadParams().replace()); + + List libraries = client.tFunctionList(); + assertEquals(Collections.singletonList("pingpong"), + libraries.stream().map(GearsLibraryInfo::getName).collect(Collectors.toList())); + } + + @Test(expected = JedisDataException.class) + public void testBadFunctionLoad() { + client.tFunctionLoad(BAD_FUNCTION); + } + + private static void assertAllLibrariesNoCode(List libraryInfos) { + assertThat(libraryInfos, Matchers.hasSize(LIBRARIES_ARRAY.length)); + + List libraryNames = libraryInfos.stream().map(GearsLibraryInfo::getName).collect(Collectors.toList()); + assertThat(libraryNames, Matchers.containsInAnyOrder(LIBRARIES_ARRAY)); + + libraryInfos.stream().map(GearsLibraryInfo::getCode).forEach(Assert::assertNull); + } + + private static void assertAllLibrariesWithCode(List libraryInfos) { + assertThat(libraryInfos, Matchers.hasSize(LIBRARIES_ARRAY.length)); + + List libraryNames = libraryInfos.stream().map(GearsLibraryInfo::getName).collect(Collectors.toList()); + assertThat(libraryNames, Matchers.containsInAnyOrder(LIBRARIES_ARRAY)); + + libraryInfos.stream().map(GearsLibraryInfo::getCode).forEach(Assert::assertNotNull); + } + + @Test + public void tFunctionListAll() throws IOException { + loadAllLibraries(); + + List libraryInfos = client.tFunctionList(); + assertAllLibrariesNoCode(libraryInfos); + } + + @Test + public void testFunctionListNoCodeVerboseZero() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().verbose(0)); + assertAllLibrariesNoCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionListNoCodeVerboseOne() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().verbose(1)); + assertAllLibrariesNoCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "stream".equalsIgnoreCase(trigger.getPrefix()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> func.getFlags().contains("raw-arguments"))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionListNoCodeVerboseTwo() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().verbose(2)); + assertAllLibrariesNoCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "stream".equalsIgnoreCase(trigger.getPrefix()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> func.getFlags().contains("raw-arguments"))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionListNoCodeVerboseThree() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().verbose(3)); + assertAllLibrariesNoCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "stream".equalsIgnoreCase(trigger.getPrefix()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> func.getFlags().contains("raw-arguments"))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionListWithCodeVerboseZero() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().withCode().verbose(0)); + assertAllLibrariesWithCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionListWithCodeVerboseOne() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().withCode().verbose(1)); + assertAllLibrariesWithCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "stream".equalsIgnoreCase(trigger.getPrefix()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> func.getFlags().contains("raw-arguments"))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionListWithCodeVerboseTwo() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().withCode().verbose(2)); + assertAllLibrariesWithCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "stream".equalsIgnoreCase(trigger.getPrefix()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> func.getFlags().contains("raw-arguments"))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionListWithCodeVerboseThree() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().withCode().verbose(3)); + assertAllLibrariesWithCode(libraryInfos); + + Map>> libraryConditions = initializeTestLibraryConditions(); + + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("streamTriggers").add(lib -> lib.getStreamTriggers().stream().anyMatch(trigger -> "stream".equalsIgnoreCase(trigger.getPrefix()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> "my_set".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withFlags").add(lib -> lib.getFunctions().stream().anyMatch(func -> func.getFlags().contains("raw-arguments"))); + libraryConditions.get("pingpong").add(lib -> lib.getFunctions().stream().anyMatch(func -> "playPingPong".equalsIgnoreCase(func.getName()))); + libraryConditions.get("keyspaceTriggers").add(lib -> lib.getKeyspaceTriggers().stream().anyMatch(trigger -> "consumer".equalsIgnoreCase(trigger.getName()))); + libraryConditions.get("hashitout").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hashy".equalsIgnoreCase(func.getName()))); + libraryConditions.get("withConfig").add(lib -> lib.getFunctions().stream().anyMatch(func -> "hset".equalsIgnoreCase(func.getName()))); + + for (GearsLibraryInfo libraryInfo : libraryInfos) { + List> conditions = libraryConditions.get(libraryInfo.getName()); + if (conditions != null && !conditions.isEmpty()) { + conditions.forEach(c -> c.test(libraryInfo)); + } + } + } + + @Test + public void testFunctionLibraryListNoCodeVerboseZero() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong")); + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertNull(libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testFunctionLibraryListNoCodeVerboseOne() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong").verbose(1)); + + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertEquals("You PING, we PONG", libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testFunctionLibraryListNoCodeVerboseTwo() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong").verbose(2)); + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertEquals("You PING, we PONG", libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testFunctionLibraryListNoCodeVerboseThree() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong").verbose(3)); + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertEquals("You PING, we PONG", libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testFunctionLibraryListWithCodeVerboseZero() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong").withCode()); + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertNull(libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNotNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testFunctionLibraryListWithCodeVerboseOne() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong").withCode().verbose(1)); + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertEquals("You PING, we PONG", libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNotNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testFunctionLibraryListWithCodeVerboseTwo() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong").withCode().verbose(2)); + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertEquals("You PING, we PONG", libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNotNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testFunctionLibraryListWithCodeVerboseThree() throws IOException { + loadAllLibraries(); + List libraryInfos = client.tFunctionList(TFunctionListParams.listParams().library("pingpong").withCode().verbose(3)); + assertEquals(1, libraryInfos.size()); + assertEquals("pingpong", libraryInfos.get(0).getName()); + assertEquals("You PING, we PONG", libraryInfos.get(0).getFunctions().get(0).getDescription()); + assertNotNull(libraryInfos.get(0).getCode()); + } + + @Test + public void testLibraryDelete() throws IOException { + loadAllLibraries(); + assertEquals("OK", client.tFunctionDelete("pingpong")); + List libraryInfos = client.tFunctionList(); + assertEquals(LIBRARIES_ARRAY.length - 1, libraryInfos.size()); + } + + @Test + public void testLibraryCallStringResult() throws IOException { + loadAllLibraries(); + Object result = client.tFunctionCall("pingpong", "playPingPong", Collections.emptyList(), + Collections.emptyList()); + assertEquals(String.class, result.getClass()); + assertEquals("PONG", result); + } + + @Test + public void testLibraryCallSetValueResult() throws IOException { + loadAllLibraries(); + Object result = client.tFunctionCall("withFlags", "my_set", Collections.singletonList("MY_KEY"), + Collections.singletonList("MY_VALUE")); + assertEquals(String.class, result.getClass()); + assertEquals("OK", result); + assertEquals("MY_VALUE", client.get("MY_KEY")); + } + + @Test + public void testLibraryCallHashResult() throws IOException { + loadAllLibraries(); + Map payload = new HashMap<>(); + payload.put("C", "Dennis Ritchie"); + payload.put("Python", "Guido van Rossum"); + payload.put("C++", "Bjarne Stroustrup"); + payload.put("JavaScript", "Brendan Eich"); + payload.put("Java", "James Gosling"); + payload.put("Ruby", "Yukihiro Matsumoto"); + + client.hmset("hash1", payload); + + Object result = client.tFunctionCall("hashitout", "hashy", Collections.singletonList("hash1"), + Collections.emptyList()); + + final Map asMap; + + if (protocol != RedisProtocol.RESP3) { + final List asList = (List) result; + asMap = flatMapToMap(asList); + + } else { + asMap = (Map) result; + } + + payload.forEach((language, author) -> { + assertThat(asMap, Matchers.hasEntry(language, author)); + }); + assertThat(Long.parseLong(asMap.get("__last_updated__")), Matchers.greaterThan(0L)); + } + + @Test + public void testFunctionLoadWithConfig() throws IOException { + loadAllLibraries(); + List argsBefore = Arrays.asList("Dictionary1", "Pollito", "Chicken"); + client.tFunctionCall("withConfig", "hset", Collections.emptyList(), argsBefore); + + String config = "{\"last_modified_field_name\":\"changed_on\"}"; + client.tFunctionLoad(readLibrary("withConfig.js"), TFunctionLoadParams.loadParams().replace().config(config)); + + List argsAfter = Arrays.asList("Dictionary2", "Gallina", "Hen"); + Object result = client.tFunctionCall("withConfig", "hset", Collections.emptyList(), argsAfter); + assertEquals(2L, result); + + Map dict1 = client.hgetAll("Dictionary1"); + Map dict2 = client.hgetAll("Dictionary2"); + + assertTrue(dict1.containsKey("Pollito")); + assertTrue(dict1.containsKey("__last_modified__")); + assertFalse(dict1.containsKey("changed_on")); + + assertTrue(dict2.containsKey("Gallina")); + assertTrue(dict2.containsKey("changed_on")); + assertFalse(dict2.containsKey("__last_modified__")); + } + + @Test + public void testLibraryCallSetValueResultAsync() throws IOException { + loadAllLibraries(); + Object result = client.tFunctionCallAsync("withFlags", "my_set", Collections.singletonList("KEY_TWO"), + Collections.singletonList("KEY_TWO_VALUE")); + assertEquals(String.class, result.getClass()); + assertEquals("OK", result); + assertEquals("KEY_TWO_VALUE", client.get("KEY_TWO")); + } + + private static String readLibrary(String filename) throws IOException { + Path path = Paths.get("src/test/resources/functions/" + filename); + return String.join("\n", Files.readAllLines(path)); + } + + private void loadAllLibraries() throws IOException { + try (Stream walk = Files.walk(Paths.get("src/test/resources/functions/"))) { + List libs = walk + .filter(p -> !Files.isDirectory(p)) // + .map(Path::toString) // + .filter(f -> f.endsWith(".js")) // + .collect(Collectors.toList()); + + libs.forEach(lib -> { + String code; + try { + code = String.join("\n", Files.readAllLines(Paths.get(lib))); + } catch (IOException e) { + throw new RuntimeException(e); + } + client.tFunctionLoad(code, TFunctionLoadParams.loadParams().replace()); + }); + } + } + + private static Map>> initializeTestLibraryConditions() { + Map>> libraryConditions = new HashMap<>(); + libraryConditions.put("streamTriggers", new ArrayList<>()); + libraryConditions.put("withFlags", new ArrayList<>()); + libraryConditions.put("pingpong", new ArrayList<>()); + libraryConditions.put("keyspaceTriggers", new ArrayList<>()); + libraryConditions.put("hashitout", new ArrayList<>()); + libraryConditions.put("withConfig", new ArrayList<>()); + + return libraryConditions; + } + + private static Map flatMapToMap(List list) { + Map map = new HashMap(list.size() / 2); + for (int i = 0; i < list.size(); i += 2) { + map.put(list.get(i), list.get(i + 1)); + } + return map; + } +} diff --git a/src/test/java/redis/clients/jedis/modules/graph/GraphTransactionTest.java b/src/test/java/redis/clients/jedis/modules/graph/GraphTransactionTest.java index 2acf488d83..c63996e7b5 100644 --- a/src/test/java/redis/clients/jedis/modules/graph/GraphTransactionTest.java +++ b/src/test/java/redis/clients/jedis/modules/graph/GraphTransactionTest.java @@ -12,7 +12,7 @@ import org.junit.BeforeClass; import org.junit.Test; -import redis.clients.jedis.Transaction; +import redis.clients.jedis.AbstractTransaction; import redis.clients.jedis.graph.Header; import redis.clients.jedis.graph.Record; import redis.clients.jedis.graph.ResultSet; @@ -53,7 +53,7 @@ public static void prepare() { @Test public void testMultiExec() { // Transaction transaction = new Transaction(c); - Transaction transaction = client.multi(); + AbstractTransaction transaction = client.multi(); transaction.set("x", "1"); transaction.graphQuery("social", "CREATE (:Person {name:'a'})"); @@ -177,7 +177,7 @@ record = iterator.next(); @Test public void testMultiExecWithReadOnlyQueries() { // Transaction transaction = new Transaction(c); - Transaction transaction = client.multi(); + AbstractTransaction transaction = client.multi(); transaction.set("x", "1"); transaction.graphQuery("social", "CREATE (:Person {name:'a'})"); diff --git a/src/test/java/redis/clients/jedis/modules/json/JsonObjects.java b/src/test/java/redis/clients/jedis/modules/json/JsonObjects.java index f605ca973f..dbe44ab3f8 100644 --- a/src/test/java/redis/clients/jedis/modules/json/JsonObjects.java +++ b/src/test/java/redis/clients/jedis/modules/json/JsonObjects.java @@ -2,7 +2,6 @@ import java.time.Instant; import java.util.List; -import java.util.Map; import java.util.Objects; public class JsonObjects { @@ -18,6 +17,16 @@ public IRLObject() { this.str = "string"; this.bool = true; } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + final IRLObject other = (IRLObject) obj; + return Objects.equals(str, other.str) + && Objects.equals(bool, other.bool); + } } @SuppressWarnings("unused") diff --git a/src/test/java/redis/clients/jedis/modules/json/RedisJsonV1Test.java b/src/test/java/redis/clients/jedis/modules/json/RedisJsonV1Test.java index 856878ce68..5843b6e06a 100644 --- a/src/test/java/redis/clients/jedis/modules/json/RedisJsonV1Test.java +++ b/src/test/java/redis/clients/jedis/modules/json/RedisJsonV1Test.java @@ -14,27 +14,29 @@ import java.util.Collections; import java.util.List; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; +import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import redis.clients.jedis.RedisProtocol; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.json.JsonSetParams; import redis.clients.jedis.json.Path; import redis.clients.jedis.json.commands.RedisJsonV1Commands; import redis.clients.jedis.modules.RedisModuleCommandsTestBase; import redis.clients.jedis.util.JsonObjectMapperTestUtil; +import redis.clients.jedis.util.RedisProtocolUtil; public class RedisJsonV1Test extends RedisModuleCommandsTestBase { private final Gson gson = new Gson(); - private RedisJsonV1Commands jsonClient; + private RedisJsonV1Commands jsonV1; @BeforeClass public static void prepare() { + Assume.assumeFalse(RedisProtocolUtil.getRedisProtocol() == RedisProtocol.RESP3); RedisModuleCommandsTestBase.prepare(); } @@ -42,7 +44,7 @@ public static void prepare() { @Override public void setUp() { super.setUp(); - this.jsonClient = super.client; + this.jsonV1 = super.client; } @Test @@ -50,152 +52,143 @@ public void basicSetGetShouldSucceed() { // naive set with a path // jsonClient.jsonSet("null", null, ROOT_PATH); - jsonClient.jsonSet("null", ROOT_PATH, (Object) null); - assertNull(client.jsonGet("null", String.class, ROOT_PATH)); + jsonV1.jsonSet("null", ROOT_PATH, (Object) null); + assertNull(jsonV1.jsonGet("null", String.class, ROOT_PATH)); // real scalar value and no path - jsonClient.jsonSet("str", ROOT_PATH, "strong"); - assertEquals("strong", jsonClient.jsonGet("str")); + jsonV1.jsonSet("str", ROOT_PATH, "strong"); + assertEquals("strong", jsonV1.jsonGet("str")); // a slightly more complex object IRLObject obj = new IRLObject(); - jsonClient.jsonSet("obj", ROOT_PATH, obj); + jsonV1.jsonSet("obj", ROOT_PATH, obj); Object expected = gson.fromJson(gson.toJson(obj), Object.class); - assertTrue(expected.equals(client.jsonGet("obj"))); + assertTrue(expected.equals(jsonV1.jsonGet("obj"))); // check an update Path p = Path.of(".str"); - jsonClient.jsonSet("obj", p, "strung"); - assertEquals("strung", jsonClient.jsonGet("obj", String.class, p)); + jsonV1.jsonSet("obj", p, "strung"); + assertEquals("strung", jsonV1.jsonGet("obj", String.class, p)); } @Test public void setExistingPathOnlyIfExistsShouldSucceed() { - jsonClient.jsonSet("obj", ROOT_PATH, new IRLObject()); + jsonV1.jsonSet("obj", ROOT_PATH, new IRLObject()); Path p = Path.of(".str"); - jsonClient.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().xx()); - assertEquals("strangle", jsonClient.jsonGet("obj", String.class, p)); + jsonV1.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().xx()); + assertEquals("strangle", jsonV1.jsonGet("obj", String.class, p)); } @Test public void setNonExistingOnlyIfNotExistsShouldSucceed() { - jsonClient.jsonSet("obj", ROOT_PATH, new IRLObject()); + jsonV1.jsonSet("obj", ROOT_PATH, new IRLObject()); Path p = Path.of(".none"); - jsonClient.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().nx()); - assertEquals("strangle", jsonClient.jsonGet("obj", String.class, p)); + jsonV1.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().nx()); + assertEquals("strangle", jsonV1.jsonGet("obj", String.class, p)); } @Test public void setWithoutAPathDefaultsToRootPath() { - jsonClient.jsonSet("obj1", ROOT_PATH, new IRLObject()); + jsonV1.jsonSet("obj1", ROOT_PATH, new IRLObject()); // jsonClient.jsonSet("obj1", "strangle", JsonSetParams.jsonSetParams().xx()); - jsonClient.jsonSetLegacy("obj1", (Object) "strangle", JsonSetParams.jsonSetParams().xx()); - assertEquals("strangle", jsonClient.jsonGet("obj1", String.class, ROOT_PATH)); + jsonV1.jsonSetLegacy("obj1", (Object) "strangle", JsonSetParams.jsonSetParams().xx()); + assertEquals("strangle", jsonV1.jsonGet("obj1", String.class, ROOT_PATH)); } @Test public void setExistingPathOnlyIfNotExistsShouldFail() { - jsonClient.jsonSet("obj", ROOT_PATH, new IRLObject()); + jsonV1.jsonSet("obj", ROOT_PATH, new IRLObject()); Path p = Path.of(".str"); - assertNull(client.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().nx())); + assertNull(jsonV1.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().nx())); } @Test public void setNonExistingPathOnlyIfExistsShouldFail() { - jsonClient.jsonSet("obj", ROOT_PATH, new IRLObject()); + jsonV1.jsonSet("obj", ROOT_PATH, new IRLObject()); Path p = Path.of(".none"); - assertNull(client.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().xx())); + assertNull(jsonV1.jsonSet("obj", p, "strangle", JsonSetParams.jsonSetParams().xx())); } @Test(expected = JedisDataException.class) public void setException() { // should error on non root path for new key - jsonClient.jsonSet("test", Path.of(".foo"), "bar"); + jsonV1.jsonSet("test", Path.of(".foo"), "bar"); } @Test public void getMultiplePathsShouldSucceed() { // check multiple paths IRLObject obj = new IRLObject(); - jsonClient.jsonSetLegacy("obj", obj); + jsonV1.jsonSetLegacy("obj", obj); Object expected = gson.fromJson(gson.toJson(obj), Object.class); - assertTrue(expected.equals(client.jsonGet("obj", Object.class, Path.of("bool"), Path.of("str")))); - } - - @Test - public void getMultiplePathsShouldSucceedWithLegacy() { - // check multiple paths - IRLObject obj = new IRLObject(); - jsonClient.jsonSetLegacy("obj", obj); - Object expected = gson.fromJson(gson.toJson(obj), Object.class); - assertTrue(expected.equals(client.jsonGet("obj", Object.class, Path.of("bool"), Path.of("str")))); + assertTrue(expected.equals(jsonV1.jsonGet("obj", Object.class, Path.of("bool"), Path.of("str")))); } @Test public void toggle() { IRLObject obj = new IRLObject(); - jsonClient.jsonSetLegacy("obj", obj); + jsonV1.jsonSetLegacy("obj", obj); Path pbool = Path.of(".bool"); // check initial value - assertTrue(client.jsonGet("obj", Boolean.class, pbool)); + assertTrue(jsonV1.jsonGet("obj", Boolean.class, pbool)); // true -> false - jsonClient.jsonToggle("obj", pbool); - assertFalse(client.jsonGet("obj", Boolean.class, pbool)); + jsonV1.jsonToggle("obj", pbool); + assertFalse(jsonV1.jsonGet("obj", Boolean.class, pbool)); // false -> true - jsonClient.jsonToggle("obj", pbool); - assertTrue(client.jsonGet("obj", Boolean.class, pbool)); + jsonV1.jsonToggle("obj", pbool); + assertTrue(jsonV1.jsonGet("obj", Boolean.class, pbool)); // ignore non-boolean field Path pstr = Path.of(".str"); try { - jsonClient.jsonToggle("obj", pstr); + jsonV1.jsonToggle("obj", pstr); fail("String not a bool"); } catch (JedisDataException jde) { assertTrue(jde.getMessage().contains("not a bool")); } - assertEquals("string", jsonClient.jsonGet("obj", String.class, pstr)); + assertEquals("string", jsonV1.jsonGet("obj", String.class, pstr)); } @Test(expected = JedisDataException.class) public void getAbsent() { - jsonClient.jsonSet("test", ROOT_PATH, "foo"); - jsonClient.jsonGet("test", String.class, Path.of(".bar")); + jsonV1.jsonSet("test", ROOT_PATH, "foo"); + jsonV1.jsonGet("test", String.class, Path.of(".bar")); } @Test public void delValidShouldSucceed() { // check deletion of a single path - jsonClient.jsonSet("obj", ROOT_PATH, new IRLObject()); - assertEquals(1L, jsonClient.jsonDel("obj", Path.of(".str"))); + jsonV1.jsonSet("obj", ROOT_PATH, new IRLObject()); + assertEquals(1L, jsonV1.jsonDel("obj", Path.of(".str"))); assertTrue(client.exists("obj")); // check deletion root using default root -> key is removed - assertEquals(1L, jsonClient.jsonDel("obj")); + assertEquals(1L, jsonV1.jsonDel("obj")); assertFalse(client.exists("obj")); } @Test public void delNonExistingPathsAreIgnored() { - jsonClient.jsonSet("foobar", ROOT_PATH, new FooBarObject()); - assertEquals(0L, jsonClient.jsonDel("foobar", Path.of(".foo[1]"))); + jsonV1.jsonSet("foobar", ROOT_PATH, new FooBarObject()); + assertEquals(0L, jsonV1.jsonDel("foobar", Path.of(".foo[1]"))); } @Test public void typeChecksShouldSucceed() { - assertNull(client.jsonType("foobar")); - jsonClient.jsonSet("foobar", ROOT_PATH, new FooBarObject()); - assertSame(Object.class, jsonClient.jsonType("foobar")); - assertSame(Object.class, jsonClient.jsonType("foobar", ROOT_PATH)); - assertSame(String.class, jsonClient.jsonType("foobar", Path.of(".foo"))); - assertSame(int.class, jsonClient.jsonType("foobar", Path.of(".fooI"))); - assertSame(float.class, jsonClient.jsonType("foobar", Path.of(".fooF"))); - assertSame(List.class, jsonClient.jsonType("foobar", Path.of(".fooArr"))); - assertSame(boolean.class, jsonClient.jsonType("foobar", Path.of(".fooB"))); - assertNull(client.jsonType("foobar", Path.of(".fooErr"))); + assertNull(jsonV1.jsonType("foobar")); + jsonV1.jsonSet("foobar", ROOT_PATH, new FooBarObject()); + assertSame(Object.class, jsonV1.jsonType("foobar")); + assertSame(Object.class, jsonV1.jsonType("foobar", ROOT_PATH)); + assertSame(String.class, jsonV1.jsonType("foobar", Path.of(".foo"))); + assertSame(int.class, jsonV1.jsonType("foobar", Path.of(".fooI"))); + assertSame(float.class, jsonV1.jsonType("foobar", Path.of(".fooF"))); + assertSame(List.class, jsonV1.jsonType("foobar", Path.of(".fooArr"))); + assertSame(boolean.class, jsonV1.jsonType("foobar", Path.of(".fooB"))); + assertNull(jsonV1.jsonType("foobar", Path.of(".fooErr"))); } @Test @@ -204,7 +197,7 @@ public void testJsonMerge() { List childrens = new ArrayList<>(); childrens.add("Child 1"); Person person = new Person("John Doe", 25, "123 Main Street", "123-456-7890", childrens); - assertEquals("OK", jsonClient.jsonSet("test_merge", ROOT_PATH, person)); + assertEquals("OK", jsonV1.jsonSet("test_merge", ROOT_PATH, person)); // After 5 years: person.age = 30; @@ -212,9 +205,9 @@ public void testJsonMerge() { person.childrens.add("Child 3"); // merge the new data - assertEquals("OK", jsonClient.jsonMerge("test_merge", Path.of((".childrens")), person.childrens)); - assertEquals("OK", jsonClient.jsonMerge("test_merge", Path.of((".age")), person.age)); - assertEquals(person, jsonClient.jsonGet("test_merge", Person.class)); + assertEquals("OK", jsonV1.jsonMerge("test_merge", Path.of((".childrens")), person.childrens)); + assertEquals("OK", jsonV1.jsonMerge("test_merge", Path.of((".age")), person.age)); + assertEquals(person, jsonV1.jsonGet("test_merge", Person.class)); } @Test @@ -224,10 +217,10 @@ public void mgetWithPathWithAllKeysExist() { Qux qux1 = new Qux("quux1", "corge1", "garply1", baz1); Qux qux2 = new Qux("quux2", "corge2", "garply2", baz2); - jsonClient.jsonSetLegacy("qux1", qux1); - jsonClient.jsonSetLegacy("qux2", qux2); + jsonV1.jsonSetLegacy("qux1", qux1); + jsonV1.jsonSetLegacy("qux2", qux2); - List allBaz = jsonClient.jsonMGet(Path.of("baz"), Baz.class, "qux1", "qux2"); + List allBaz = jsonV1.jsonMGet(Path.of("baz"), Baz.class, "qux1", "qux2"); assertEquals(2, allBaz.size()); @@ -251,10 +244,10 @@ public void mgetAtRootPathWithMissingKeys() { Qux qux1 = new Qux("quux1", "corge1", "garply1", baz1); Qux qux2 = new Qux("quux2", "corge2", "garply2", baz2); - jsonClient.jsonSetLegacy("qux1", qux1); - jsonClient.jsonSetLegacy("qux2", qux2); + jsonV1.jsonSetLegacy("qux1", qux1); + jsonV1.jsonSetLegacy("qux2", qux2); - List allQux = jsonClient.jsonMGet(Qux.class, "qux1", "qux2", "qux3"); + List allQux = jsonV1.jsonMGet(Qux.class, "qux1", "qux2", "qux3"); assertEquals(3, allQux.size()); assertNull(allQux.get(2)); @@ -264,31 +257,31 @@ public void mgetAtRootPathWithMissingKeys() { @Test public void arrLen() { - jsonClient.jsonSet("foobar", ROOT_PATH, new FooBarObject()); - assertEquals(Long.valueOf(3), jsonClient.jsonArrLen("foobar", Path.of(".fooArr"))); + jsonV1.jsonSet("foobar", ROOT_PATH, new FooBarObject()); + assertEquals(Long.valueOf(3), jsonV1.jsonArrLen("foobar", Path.of(".fooArr"))); } @Test public void arrLenDefaultPath() { - assertNull(client.jsonArrLen("array")); - jsonClient.jsonSetLegacy("array", new int[]{1, 2, 3}); - assertEquals(Long.valueOf(3), jsonClient.jsonArrLen("array")); + assertNull(jsonV1.jsonArrLen("array")); + jsonV1.jsonSetLegacy("array", new int[]{1, 2, 3}); + assertEquals(Long.valueOf(3), jsonV1.jsonArrLen("array")); } @Test public void clearArray() { - jsonClient.jsonSet("foobar", ROOT_PATH, new FooBarObject()); + jsonV1.jsonSet("foobar", ROOT_PATH, new FooBarObject()); Path arrPath = Path.of(".fooArr"); - assertEquals(Long.valueOf(3), jsonClient.jsonArrLen("foobar", arrPath)); + assertEquals(Long.valueOf(3), jsonV1.jsonArrLen("foobar", arrPath)); - assertEquals(1L, jsonClient.jsonClear("foobar", arrPath)); - assertEquals(Long.valueOf(0), jsonClient.jsonArrLen("foobar", arrPath)); + assertEquals(1L, jsonV1.jsonClear("foobar", arrPath)); + assertEquals(Long.valueOf(0), jsonV1.jsonArrLen("foobar", arrPath)); // ignore non-array Path strPath = Path.of("foo"); - assertEquals(0L, jsonClient.jsonClear("foobar", strPath)); - assertEquals("bar", jsonClient.jsonGet("foobar", String.class, strPath)); + assertEquals(0L, jsonV1.jsonClear("foobar", strPath)); + assertEquals("bar", jsonV1.jsonGet("foobar", String.class, strPath)); } @Test @@ -296,12 +289,12 @@ public void clearObject() { Baz baz = new Baz("quuz", "grault", "waldo"); Qux qux = new Qux("quux", "corge", "garply", baz); - jsonClient.jsonSetLegacy("qux", qux); + jsonV1.jsonSetLegacy("qux", qux); Path objPath = Path.of("baz"); - assertEquals(baz, jsonClient.jsonGet("qux", Baz.class, objPath)); + assertEquals(baz, jsonV1.jsonGet("qux", Baz.class, objPath)); - assertEquals(1L, jsonClient.jsonClear("qux", objPath)); - assertEquals(new Baz(null, null, null), jsonClient.jsonGet("qux", Baz.class, objPath)); + assertEquals(1L, jsonV1.jsonClear("qux", objPath)); + assertEquals(new Baz(null, null, null), jsonV1.jsonGet("qux", Baz.class, objPath)); } @Test @@ -309,10 +302,10 @@ public void arrAppendSameType() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - jsonClient.jsonSet("test_arrappend", ROOT_PATH, jsonObject); - assertEquals(Long.valueOf(6), jsonClient.jsonArrAppend("test_arrappend", Path.of(".b"), 4, 5, 6)); + jsonV1.jsonSet("test_arrappend", ROOT_PATH, jsonObject); + assertEquals(Long.valueOf(6), jsonV1.jsonArrAppend("test_arrappend", Path.of(".b"), 4, 5, 6)); - Integer[] array = jsonClient.jsonGet("test_arrappend", Integer[].class, Path.of(".b")); + Integer[] array = jsonV1.jsonGet("test_arrappend", Integer[].class, Path.of(".b")); assertArrayEquals(new Integer[]{1, 2, 3, 4, 5, 6}, array); } @@ -321,10 +314,10 @@ public void arrAppendMultipleTypes() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - jsonClient.jsonSet("test_arrappend", ROOT_PATH, jsonObject); - assertEquals(Long.valueOf(6), jsonClient.jsonArrAppend("test_arrappend", Path.of(".b"), "foo", true, null)); + jsonV1.jsonSet("test_arrappend", ROOT_PATH, jsonObject); + assertEquals(Long.valueOf(6), jsonV1.jsonArrAppend("test_arrappend", Path.of(".b"), "foo", true, null)); - Object[] array = jsonClient.jsonGet("test_arrappend", Object[].class, Path.of(".b")); + Object[] array = jsonV1.jsonGet("test_arrappend", Object[].class, Path.of(".b")); // NOTE: GSon converts numeric types to the most accommodating type (Double) // when type information is not provided (as in the Object[] below) @@ -336,10 +329,10 @@ public void arrAppendMultipleTypesWithDeepPath() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - jsonClient.jsonSet("test_arrappend", ROOT_PATH, jsonObject); - assertEquals(Long.valueOf(4), jsonClient.jsonArrAppend("test_arrappend", Path.of(".c.d"), "foo", true, null)); + jsonV1.jsonSet("test_arrappend", ROOT_PATH, jsonObject); + assertEquals(Long.valueOf(4), jsonV1.jsonArrAppend("test_arrappend", Path.of(".c.d"), "foo", true, null)); - Object[] array = jsonClient.jsonGet("test_arrappend", Object[].class, Path.of(".c.d")); + Object[] array = jsonV1.jsonGet("test_arrappend", Object[].class, Path.of(".c.d")); assertArrayEquals(new Object[]{"ello", "foo", true, null}, array); } @@ -348,10 +341,10 @@ public void arrAppendAgaintsEmptyArray() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: [] }}"; JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - jsonClient.jsonSet("test_arrappend", ROOT_PATH, jsonObject); - assertEquals(Long.valueOf(3), jsonClient.jsonArrAppend("test_arrappend", Path.of(".c.d"), "a", "b", "c")); + jsonV1.jsonSet("test_arrappend", ROOT_PATH, jsonObject); + assertEquals(Long.valueOf(3), jsonV1.jsonArrAppend("test_arrappend", Path.of(".c.d"), "a", "b", "c")); - String[] array = jsonClient.jsonGet("test_arrappend", String[].class, Path.of(".c.d")); + String[] array = jsonV1.jsonGet("test_arrappend", String[].class, Path.of(".c.d")); assertArrayEquals(new String[]{"a", "b", "c"}, array); } @@ -360,38 +353,38 @@ public void arrAppendPathIsNotArray() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - jsonClient.jsonSet("test_arrappend", ROOT_PATH, jsonObject); - jsonClient.jsonArrAppend("test_arrappend", Path.of(".a"), 1); + jsonV1.jsonSet("test_arrappend", ROOT_PATH, jsonObject); + jsonV1.jsonArrAppend("test_arrappend", Path.of(".a"), 1); } @Test(expected = JedisDataException.class) public void arrIndexAbsentKey() { - jsonClient.jsonArrIndex("quxquux", ROOT_PATH, gson.toJson(new Object())); + jsonV1.jsonArrIndex("quxquux", ROOT_PATH, gson.toJson(new Object())); } @Test public void arrIndexWithInts() { - jsonClient.jsonSet("quxquux", ROOT_PATH, new int[]{8, 6, 7, 5, 3, 0, 9}); - assertEquals(2L, jsonClient.jsonArrIndex("quxquux", ROOT_PATH, 7)); - assertEquals(-1L, jsonClient.jsonArrIndex("quxquux", ROOT_PATH, "7")); + jsonV1.jsonSet("quxquux", ROOT_PATH, new int[]{8, 6, 7, 5, 3, 0, 9}); + assertEquals(2L, jsonV1.jsonArrIndex("quxquux", ROOT_PATH, 7)); + assertEquals(-1L, jsonV1.jsonArrIndex("quxquux", ROOT_PATH, "7")); } @Test public void arrIndexWithStrings() { - jsonClient.jsonSet("quxquux", ROOT_PATH, new String[]{"8", "6", "7", "5", "3", "0", "9"}); - assertEquals(2L, jsonClient.jsonArrIndex("quxquux", ROOT_PATH, "7")); + jsonV1.jsonSet("quxquux", ROOT_PATH, new String[]{"8", "6", "7", "5", "3", "0", "9"}); + assertEquals(2L, jsonV1.jsonArrIndex("quxquux", ROOT_PATH, "7")); } @Test public void arrIndexWithStringsAndPath() { - jsonClient.jsonSet("foobar", ROOT_PATH, new FooBarObject()); - assertEquals(1L, jsonClient.jsonArrIndex("foobar", Path.of(".fooArr"), "b")); + jsonV1.jsonSet("foobar", ROOT_PATH, new FooBarObject()); + assertEquals(1L, jsonV1.jsonArrIndex("foobar", Path.of(".fooArr"), "b")); } @Test(expected = JedisDataException.class) public void arrIndexNonExistentPath() { - jsonClient.jsonSet("foobar", ROOT_PATH, new FooBarObject()); - assertEquals(1L, jsonClient.jsonArrIndex("foobar", Path.of(".barArr"), "x")); + jsonV1.jsonSet("foobar", ROOT_PATH, new FooBarObject()); + assertEquals(1L, jsonV1.jsonArrIndex("foobar", Path.of(".barArr"), "x")); } @Test @@ -399,10 +392,10 @@ public void arrInsert() { String json = "['hello', 'world', true, 1, 3, null, false]"; JsonArray jsonArray = gson.fromJson(json, JsonArray.class); - jsonClient.jsonSet("test_arrinsert", ROOT_PATH, jsonArray); - assertEquals(8L, jsonClient.jsonArrInsert("test_arrinsert", ROOT_PATH, 1, "foo")); + jsonV1.jsonSet("test_arrinsert", ROOT_PATH, jsonArray); + assertEquals(8L, jsonV1.jsonArrInsert("test_arrinsert", ROOT_PATH, 1, "foo")); - Object[] array = jsonClient.jsonGet("test_arrinsert", Object[].class, ROOT_PATH); + Object[] array = jsonV1.jsonGet("test_arrinsert", Object[].class, ROOT_PATH); // NOTE: GSon converts numeric types to the most accommodating type (Double) // when type information is not provided (as in the Object[] below) @@ -414,120 +407,88 @@ public void arrInsertWithNegativeIndex() { String json = "['hello', 'world', true, 1, 3, null, false]"; JsonArray jsonArray = gson.fromJson(json, JsonArray.class); - jsonClient.jsonSet("test_arrinsert", ROOT_PATH, jsonArray); - assertEquals(8L, jsonClient.jsonArrInsert("test_arrinsert", ROOT_PATH, -1, "foo")); + jsonV1.jsonSet("test_arrinsert", ROOT_PATH, jsonArray); + assertEquals(8L, jsonV1.jsonArrInsert("test_arrinsert", ROOT_PATH, -1, "foo")); - Object[] array = jsonClient.jsonGet("test_arrinsert", Object[].class, ROOT_PATH); + Object[] array = jsonV1.jsonGet("test_arrinsert", Object[].class, ROOT_PATH); assertArrayEquals(new Object[]{"hello", "world", true, 1.0, 3.0, null, "foo", false}, array); } @Test public void testArrayPop() { - jsonClient.jsonSet("arr", ROOT_PATH, new int[]{0, 1, 2, 3, 4}); - assertEquals(Long.valueOf(4), jsonClient.jsonArrPop("arr", Long.class, ROOT_PATH)); - assertEquals(Long.valueOf(3), jsonClient.jsonArrPop("arr", Long.class, ROOT_PATH, -1)); - assertEquals(Long.valueOf(2), jsonClient.jsonArrPop("arr", Long.class)); - assertEquals(Long.valueOf(0), jsonClient.jsonArrPop("arr", Long.class, ROOT_PATH, 0)); - assertEquals(Double.valueOf(1), jsonClient.jsonArrPop("arr")); + jsonV1.jsonSet("arr", ROOT_PATH, new int[]{0, 1, 2, 3, 4}); + assertEquals(Long.valueOf(4), jsonV1.jsonArrPop("arr", Long.class, ROOT_PATH)); + assertEquals(Long.valueOf(3), jsonV1.jsonArrPop("arr", Long.class, ROOT_PATH, -1)); + assertEquals(Long.valueOf(2), jsonV1.jsonArrPop("arr", Long.class)); + assertEquals(Long.valueOf(0), jsonV1.jsonArrPop("arr", Long.class, ROOT_PATH, 0)); + assertEquals(Double.valueOf(1), jsonV1.jsonArrPop("arr")); } @Test public void arrTrim() { - jsonClient.jsonSet("arr", ROOT_PATH, new int[]{0, 1, 2, 3, 4}); - assertEquals(Long.valueOf(3), jsonClient.jsonArrTrim("arr", ROOT_PATH, 1, 3)); - assertArrayEquals(new Integer[]{1, 2, 3}, jsonClient.jsonGet("arr", Integer[].class, ROOT_PATH)); + jsonV1.jsonSet("arr", ROOT_PATH, new int[]{0, 1, 2, 3, 4}); + assertEquals(Long.valueOf(3), jsonV1.jsonArrTrim("arr", ROOT_PATH, 1, 3)); + assertArrayEquals(new Integer[]{1, 2, 3}, jsonV1.jsonGet("arr", Integer[].class, ROOT_PATH)); } @Test public void strAppend() { - jsonClient.jsonSet("str", ROOT_PATH, "foo"); - assertEquals(6L, jsonClient.jsonStrAppend("str", ROOT_PATH, "bar")); - assertEquals("foobar", jsonClient.jsonGet("str", String.class, ROOT_PATH)); - assertEquals(8L, jsonClient.jsonStrAppend("str", "ed")); + jsonV1.jsonSet("str", ROOT_PATH, "foo"); + assertEquals(6L, jsonV1.jsonStrAppend("str", ROOT_PATH, "bar")); + assertEquals("foobar", jsonV1.jsonGet("str", String.class, ROOT_PATH)); + assertEquals(8L, jsonV1.jsonStrAppend("str", "ed")); // assertEquals("foobared", jsonClient.jsonGet("str", String.class)); - assertEquals("foobared", jsonClient.jsonGet("str")); + assertEquals("foobared", jsonV1.jsonGet("str")); } @Test public void strLen() { - assertNull(client.jsonStrLen("str")); - jsonClient.jsonSet("str", ROOT_PATH, "foo"); - assertEquals(Long.valueOf(3), jsonClient.jsonStrLen("str")); - assertEquals(Long.valueOf(3), jsonClient.jsonStrLen("str", ROOT_PATH)); + assertNull(jsonV1.jsonStrLen("str")); + jsonV1.jsonSet("str", ROOT_PATH, "foo"); + assertEquals(Long.valueOf(3), jsonV1.jsonStrLen("str")); + assertEquals(Long.valueOf(3), jsonV1.jsonStrLen("str", ROOT_PATH)); } @Test public void numIncrBy() { - jsonClient.jsonSetLegacy("doc", gson.fromJson("{a:3}", JsonObject.class)); - assertEquals(5d, jsonClient.jsonNumIncrBy("doc", Path.of(".a"), 2), 0d); + jsonV1.jsonSetLegacy("doc", gson.fromJson("{a:3}", JsonObject.class)); + assertEquals(5d, jsonV1.jsonNumIncrBy("doc", Path.of(".a"), 2), 0d); } @Test public void obj() { - assertNull(client.jsonObjLen("doc")); - assertNull(client.jsonObjKeys("doc")); - assertNull(client.jsonObjLen("doc", ROOT_PATH)); - assertNull(client.jsonObjKeys("doc", ROOT_PATH)); + assertNull(jsonV1.jsonObjLen("doc")); + assertNull(jsonV1.jsonObjKeys("doc")); + assertNull(jsonV1.jsonObjLen("doc", ROOT_PATH)); + assertNull(jsonV1.jsonObjKeys("doc", ROOT_PATH)); String json = "{\"a\":[3], \"nested\": {\"a\": {\"b\":2, \"c\": 1}}}"; - jsonClient.jsonSetWithPlainString("doc", ROOT_PATH, json); - assertEquals(Long.valueOf(2), jsonClient.jsonObjLen("doc")); - assertEquals(Arrays.asList("a", "nested"), jsonClient.jsonObjKeys("doc")); - assertEquals(Long.valueOf(2), jsonClient.jsonObjLen("doc", Path.of(".nested.a"))); - assertEquals(Arrays.asList("b", "c"), jsonClient.jsonObjKeys("doc", Path.of(".nested.a"))); + jsonV1.jsonSetWithPlainString("doc", ROOT_PATH, json); + assertEquals(Long.valueOf(2), jsonV1.jsonObjLen("doc")); + assertEquals(Arrays.asList("a", "nested"), jsonV1.jsonObjKeys("doc")); + assertEquals(Long.valueOf(2), jsonV1.jsonObjLen("doc", Path.of(".nested.a"))); + assertEquals(Arrays.asList("b", "c"), jsonV1.jsonObjKeys("doc", Path.of(".nested.a"))); } @Test public void debugMemory() { - assertEquals(0L, jsonClient.jsonDebugMemory("json")); - assertEquals(0L, jsonClient.jsonDebugMemory("json", ROOT_PATH)); + assertEquals(0L, jsonV1.jsonDebugMemory("json")); + assertEquals(0L, jsonV1.jsonDebugMemory("json", ROOT_PATH)); String json = "{ foo: 'bar', bar: { foo: 10 }}"; JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - jsonClient.jsonSet("json", ROOT_PATH, jsonObject); + jsonV1.jsonSet("json", ROOT_PATH, jsonObject); // it is okay as long as any 'long' is returned - jsonClient.jsonDebugMemory("json"); - jsonClient.jsonDebugMemory("json", ROOT_PATH); - jsonClient.jsonDebugMemory("json", Path.of(".bar")); + jsonV1.jsonDebugMemory("json"); + jsonV1.jsonDebugMemory("json", ROOT_PATH); + jsonV1.jsonDebugMemory("json", Path.of(".bar")); } @Test public void plainString() { String json = "{\"foo\":\"bar\",\"bar\":{\"foo\":10}}"; - assertEquals("OK", jsonClient.jsonSetWithPlainString("plain", ROOT_PATH, json)); - assertEquals(json, jsonClient.jsonGetAsPlainString("plain", ROOT_PATH)); - } - - @Test - public void resp() { - assertNull(client.jsonResp("resp")); - assertNull(client.jsonResp("resp", ROOT_PATH)); - - String json = "{\"foo\": {\"hello\":\"world\"}, \"bar\": [null, 3, 2.5, true]}"; - jsonClient.jsonSetWithPlainString("resp", ROOT_PATH, json); - - List resp = jsonClient.jsonResp("resp"); - assertEquals("{", resp.get(0)); - - assertEquals("foo", resp.get(1)); - assertEquals(Arrays.asList("{", "hello", "world"), resp.get(2)); - - assertEquals("bar", resp.get(3)); - List arr = (List) resp.get(4); - assertEquals("[", arr.get(0)); - assertNull(arr.get(1)); - assertEquals(Long.valueOf(3), arr.get(2)); - //assertEquals("2.5", arr.get(3)); - MatcherAssert.assertThat(arr.get(3), Matchers.isOneOf("2.5", 2.5)); - assertEquals("true", arr.get(4)); - - arr = jsonClient.jsonResp("resp", Path.of(".bar")); - assertEquals("[", arr.get(0)); - assertNull(arr.get(1)); - assertEquals(Long.valueOf(3), arr.get(2)); - //assertEquals("2.5", arr.get(3)); - MatcherAssert.assertThat(arr.get(3), Matchers.isOneOf("2.5", 2.5)); - assertEquals("true", arr.get(4)); + assertEquals("OK", jsonV1.jsonSetWithPlainString("plain", ROOT_PATH, json)); + assertEquals(json, jsonV1.jsonGetAsPlainString("plain", ROOT_PATH)); } @Test @@ -537,22 +498,22 @@ public void testJsonGsonParser() { // setting the custom json gson parser client.setJsonObjectMapper(JsonObjectMapperTestUtil.getCustomGsonObjectMapper()); - jsonClient.jsonSet(person.getId(), ROOT_PATH, person); + jsonV1.jsonSet(person.getId(), ROOT_PATH, person); - String valueExpected = jsonClient.jsonGet(person.getId(), String.class, Path.of(".created")); + String valueExpected = jsonV1.jsonGet(person.getId(), String.class, Path.of(".created")); assertEquals(valueExpected, person.getCreated().toString()); } @Test public void testDefaultJsonGsonParserStringsMustBeDifferent() { - Tick person = new Tick("foo", Instant.now()); + Tick tick = new Tick("foo", Instant.now()); // using the default json gson parser which is automatically configured - jsonClient.jsonSet(person.getId(), ROOT_PATH, person); + jsonV1.jsonSet(tick.getId(), ROOT_PATH, tick); - Object valueExpected = jsonClient.jsonGet(person.getId(), Path.of(".created")); - assertNotEquals(valueExpected, person.getCreated().toString()); + Object valueExpected = jsonV1.jsonGet(tick.getId(), Path.of(".created")); + assertNotEquals(valueExpected, tick.getCreated().toString()); } @Test @@ -562,9 +523,9 @@ public void testJsonJacksonParser() { // setting the custom json jackson parser client.setJsonObjectMapper(JsonObjectMapperTestUtil.getCustomJacksonObjectMapper()); - jsonClient.jsonSet(person.getId(), ROOT_PATH, person); + jsonV1.jsonSet(person.getId(), ROOT_PATH, person); - String valueExpected = jsonClient.jsonGet(person.getId(), String.class, Path.of(".created")); + String valueExpected = jsonV1.jsonGet(person.getId(), String.class, Path.of(".created")); assertEquals(valueExpected, person.getCreated().toString()); } } diff --git a/src/test/java/redis/clients/jedis/modules/json/RedisJsonV2Test.java b/src/test/java/redis/clients/jedis/modules/json/RedisJsonV2Test.java index d63fd4d663..f36832da51 100644 --- a/src/test/java/redis/clients/jedis/modules/json/RedisJsonV2Test.java +++ b/src/test/java/redis/clients/jedis/modules/json/RedisJsonV2Test.java @@ -9,25 +9,26 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; import org.json.JSONArray; import org.json.JSONObject; +import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import redis.clients.jedis.RedisProtocol; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.json.JsonSetParams; import redis.clients.jedis.json.Path2; import redis.clients.jedis.json.commands.RedisJsonV2Commands; import redis.clients.jedis.modules.RedisModuleCommandsTestBase; +import redis.clients.jedis.util.RedisProtocolUtil; public class RedisJsonV2Test extends RedisModuleCommandsTestBase { private static final Gson gson = new Gson(); - private RedisJsonV2Commands jsonClient; + private RedisJsonV2Commands jsonV2; @BeforeClass public static void prepare() { @@ -38,84 +39,107 @@ public static void prepare() { @Override public void setUp() { super.setUp(); - this.jsonClient = super.client; + this.jsonV2 = super.client; } @Test public void basicSetGetShouldSucceed() { + Assume.assumeFalse(RedisProtocolUtil.getRedisProtocol() == RedisProtocol.RESP3); // naive set with a path -// jsonClient.jsonSet("null", null, ROOT_PATH); - jsonClient.jsonSetWithEscape("null", ROOT_PATH, (Object) null); - assertJsonArrayEquals(jsonArray((Object) null), jsonClient.jsonGet("null", ROOT_PATH)); + jsonV2.jsonSetWithEscape("null", ROOT_PATH, (Object) null); + assertJsonArrayEquals(jsonArray((Object) null), jsonV2.jsonGet("null", ROOT_PATH)); // real scalar value and no path - jsonClient.jsonSetWithEscape("str", "strong"); - assertEquals("strong", jsonClient.jsonGet("str")); + jsonV2.jsonSetWithEscape("str", "strong"); + assertEquals("strong", jsonV2.jsonGet("str")); // a slightly more complex object IRLObject obj = new IRLObject(); - jsonClient.jsonSetWithEscape("obj", obj); + jsonV2.jsonSetWithEscape("obj", obj); Object expected = gson.fromJson(gson.toJson(obj), Object.class); - assertTrue(expected.equals(jsonClient.jsonGet("obj"))); + assertTrue(expected.equals(jsonV2.jsonGet("obj"))); // check an update Path2 p = Path2.of(".str"); - jsonClient.jsonSet("obj", p, gson.toJson("strung")); - assertJsonArrayEquals(jsonArray("strung"), jsonClient.jsonGet("obj", p)); + jsonV2.jsonSet("obj", p, gson.toJson("strung")); + assertJsonArrayEquals(jsonArray("strung"), jsonV2.jsonGet("obj", p)); + } + + @Test + public void basicSetGetShouldSucceedResp3() { + Assume.assumeTrue(RedisProtocolUtil.getRedisProtocol() == RedisProtocol.RESP3); + + // naive set with a path + jsonV2.jsonSetWithEscape("null", ROOT_PATH, (Object) null); + assertJsonArrayEquals(jsonArray((Object) null), jsonV2.jsonGet("null", ROOT_PATH)); + + // real scalar value and no path + jsonV2.jsonSetWithEscape("str", "strong"); + assertJsonArrayEquals(jsonArray("strong"), jsonV2.jsonGet("str")); + + // a slightly more complex object + IRLObject obj = new IRLObject(); + jsonV2.jsonSetWithEscape("obj", obj); + assertJsonArrayEquals(jsonArray(new JSONObject(gson.toJson(obj))), jsonV2.jsonGet("obj")); + + // check an update + Path2 p = Path2.of(".str"); + jsonV2.jsonSet("obj", p, gson.toJson("strung")); + assertJsonArrayEquals(jsonArray("strung"), jsonV2.jsonGet("obj", p)); } @Test public void setExistingPathOnlyIfExistsShouldSucceed() { - jsonClient.jsonSetWithEscape("obj", new IRLObject()); + jsonV2.jsonSetWithEscape("obj", new IRLObject()); Path2 p = Path2.of(".str"); - jsonClient.jsonSetWithEscape("obj", p, "strangle", JsonSetParams.jsonSetParams().xx()); - assertJsonArrayEquals(jsonArray("strangle"), jsonClient.jsonGet("obj", p)); + jsonV2.jsonSetWithEscape("obj", p, "strangle", JsonSetParams.jsonSetParams().xx()); + assertJsonArrayEquals(jsonArray("strangle"), jsonV2.jsonGet("obj", p)); } @Test public void setNonExistingOnlyIfNotExistsShouldSucceed() { - jsonClient.jsonSet("obj", gson.toJson(new IRLObject())); + jsonV2.jsonSet("obj", gson.toJson(new IRLObject())); Path2 p = Path2.of(".none"); - jsonClient.jsonSet("obj", p, gson.toJson("strangle"), JsonSetParams.jsonSetParams().nx()); - assertJsonArrayEquals(jsonArray("strangle"), jsonClient.jsonGet("obj", p)); + jsonV2.jsonSet("obj", p, gson.toJson("strangle"), JsonSetParams.jsonSetParams().nx()); + assertJsonArrayEquals(jsonArray("strangle"), jsonV2.jsonGet("obj", p)); } @Test public void setWithoutAPathDefaultsToRootPath() { String objStr = gson.toJson(new IRLObject()); - jsonClient.jsonSet("obj1", new JSONObject(objStr)); + jsonV2.jsonSet("obj1", new JSONObject(objStr)); // jsonClient.jsonSet("obj1", "strangle", JsonSetParams.jsonSetParams().xx()); - jsonClient.jsonSetWithEscape("obj1", (Object) "strangle", JsonSetParams.jsonSetParams().xx()); - assertJsonArrayEquals(jsonArray("strangle"), jsonClient.jsonGet("obj1", ROOT_PATH)); + jsonV2.jsonSetWithEscape("obj1", (Object) "strangle", JsonSetParams.jsonSetParams().xx()); + assertJsonArrayEquals(jsonArray("strangle"), jsonV2.jsonGet("obj1", ROOT_PATH)); } @Test public void setExistingPathOnlyIfNotExistsShouldFail() { - jsonClient.jsonSetWithEscape("obj", new IRLObject()); + jsonV2.jsonSetWithEscape("obj", new IRLObject()); Path2 p = Path2.of(".str"); - assertNull(jsonClient.jsonSetWithEscape("obj", p, "strangle", JsonSetParams.jsonSetParams().nx())); + assertNull(jsonV2.jsonSetWithEscape("obj", p, "strangle", JsonSetParams.jsonSetParams().nx())); } @Test public void setNonExistingPathOnlyIfExistsShouldFail() { - jsonClient.jsonSetWithEscape("obj", new IRLObject()); + jsonV2.jsonSetWithEscape("obj", new IRLObject()); Path2 p = Path2.of(".none"); - assertNull(jsonClient.jsonSetWithEscape("obj", p, "strangle", JsonSetParams.jsonSetParams().xx())); + assertNull(jsonV2.jsonSetWithEscape("obj", p, "strangle", JsonSetParams.jsonSetParams().xx())); } @Test(expected = JedisDataException.class) public void setException() { // should error on non root path for new key - jsonClient.jsonSet("test", Path2.of(".foo"), "bar"); + jsonV2.jsonSet("test", Path2.of(".foo"), "bar"); } @Test public void getMultiplePathsShouldSucceed() { // check multiple paths IRLObject obj = new IRLObject(); - jsonClient.jsonSetWithEscape("obj", obj); - JSONObject result = (JSONObject) jsonClient.jsonGet("obj", Path2.of("bool"), Path2.of("str")); + jsonV2.jsonSetWithEscape("obj", obj); + JSONObject result = (JSONObject) jsonV2.jsonGet("obj", Path2.of("bool"), Path2.of("str")); assertJsonArrayEquals(jsonArray(true), result.get("$.bool")); assertJsonArrayEquals(jsonArray("string"), result.get("$.str")); } @@ -127,90 +151,90 @@ public void getMultiLevels() { JSONObject inner = new JSONObject(); inner.put("foo", "Jane"); obj.put("bar", inner); - jsonClient.jsonSet("multi", obj); - assertJsonArrayEquals(jsonArray("John", "Jane"), jsonClient.jsonGet("multi", new Path2("..foo"))); + jsonV2.jsonSet("multi", obj); + assertJsonArrayEquals(jsonArray("John", "Jane"), jsonV2.jsonGet("multi", new Path2("..foo"))); } @Test public void toggle() { IRLObject obj = new IRLObject(); - jsonClient.jsonSetWithEscape("obj", obj); + jsonV2.jsonSetWithEscape("obj", obj); Path2 pbool = Path2.of(".bool"); // check initial value - assertJsonArrayEquals(jsonArray(true), jsonClient.jsonGet("obj", pbool)); + assertJsonArrayEquals(jsonArray(true), jsonV2.jsonGet("obj", pbool)); // true -> false - jsonClient.jsonToggle("obj", pbool); - assertJsonArrayEquals(jsonArray(false), jsonClient.jsonGet("obj", pbool)); + jsonV2.jsonToggle("obj", pbool); + assertJsonArrayEquals(jsonArray(false), jsonV2.jsonGet("obj", pbool)); // false -> true - jsonClient.jsonToggle("obj", pbool); - assertJsonArrayEquals(jsonArray(true), jsonClient.jsonGet("obj", pbool)); + jsonV2.jsonToggle("obj", pbool); + assertJsonArrayEquals(jsonArray(true), jsonV2.jsonGet("obj", pbool)); // ignore non-boolean field Path2 pstr = Path2.of(".str"); - assertEquals(singletonList(null), jsonClient.jsonToggle("obj", pstr)); - assertJsonArrayEquals(jsonArray("string"), jsonClient.jsonGet("obj", pstr)); + assertEquals(singletonList(null), jsonV2.jsonToggle("obj", pstr)); + assertJsonArrayEquals(jsonArray("string"), jsonV2.jsonGet("obj", pstr)); } @Test public void getAbsent() { - jsonClient.jsonSetWithEscape("test", ROOT_PATH, "foo"); - assertJsonArrayEquals(jsonArray(), jsonClient.jsonGet("test", Path2.of(".bar"))); + jsonV2.jsonSetWithEscape("test", ROOT_PATH, "foo"); + assertJsonArrayEquals(jsonArray(), jsonV2.jsonGet("test", Path2.of(".bar"))); } @Test public void delValidShouldSucceed() { // check deletion of a single path - jsonClient.jsonSetWithEscape("obj", ROOT_PATH, new IRLObject()); - assertEquals(1L, jsonClient.jsonDel("obj", Path2.of(".str"))); + jsonV2.jsonSetWithEscape("obj", ROOT_PATH, new IRLObject()); + assertEquals(1L, jsonV2.jsonDel("obj", Path2.of(".str"))); assertTrue(client.exists("obj")); // check deletion root using default root -> key is removed - assertEquals(1L, jsonClient.jsonDel("obj")); + assertEquals(1L, jsonV2.jsonDel("obj")); assertFalse(client.exists("obj")); } @Test public void delNonExistingPathsAreIgnored() { - jsonClient.jsonSetWithEscape("foobar", ROOT_PATH, new FooBarObject()); - assertEquals(0L, jsonClient.jsonDel("foobar", Path2.of(".foo[1]"))); + jsonV2.jsonSetWithEscape("foobar", ROOT_PATH, new FooBarObject()); + assertEquals(0L, jsonV2.jsonDel("foobar", Path2.of(".foo[1]"))); } @Test public void typeChecksShouldSucceed() { - jsonClient.jsonSet("foobar", ROOT_PATH, new JSONObject(gson.toJson(new FooBarObject()))); - assertEquals(singletonList(Object.class), jsonClient.jsonType("foobar", ROOT_PATH)); - assertEquals(singletonList(String.class), jsonClient.jsonType("foobar", Path2.of(".foo"))); - assertEquals(singletonList(int.class), jsonClient.jsonType("foobar", Path2.of(".fooI"))); - assertEquals(singletonList(float.class), jsonClient.jsonType("foobar", Path2.of(".fooF"))); - assertEquals(singletonList(List.class), jsonClient.jsonType("foobar", Path2.of(".fooArr"))); - assertEquals(singletonList(boolean.class), jsonClient.jsonType("foobar", Path2.of(".fooB"))); - assertEquals(Collections.emptyList(), jsonClient.jsonType("foobar", Path2.of(".fooErr"))); + jsonV2.jsonSet("foobar", ROOT_PATH, new JSONObject(gson.toJson(new FooBarObject()))); + assertEquals(singletonList(Object.class), jsonV2.jsonType("foobar", ROOT_PATH)); + assertEquals(singletonList(String.class), jsonV2.jsonType("foobar", Path2.of(".foo"))); + assertEquals(singletonList(int.class), jsonV2.jsonType("foobar", Path2.of(".fooI"))); + assertEquals(singletonList(float.class), jsonV2.jsonType("foobar", Path2.of(".fooF"))); + assertEquals(singletonList(List.class), jsonV2.jsonType("foobar", Path2.of(".fooArr"))); + assertEquals(singletonList(boolean.class), jsonV2.jsonType("foobar", Path2.of(".fooB"))); + assertEquals(Collections.emptyList(), jsonV2.jsonType("foobar", Path2.of(".fooErr"))); } @Test public void testJsonMerge() { // Test with root path JSONObject json = new JSONObject("{\"person\":{\"name\":\"John Doe\",\"age\":25,\"address\":{\"home\":\"123 Main Street\"},\"phone\":\"123-456-7890\"}}"); - assertEquals("OK", jsonClient.jsonSet("test_merge", json)); + assertEquals("OK", jsonV2.jsonSet("test_merge", json)); json = new JSONObject("{\"person\":{\"name\":\"John Doe\",\"age\":30,\"address\":{\"home\":\"123 Main Street\"},\"phone\":\"123-456-7890\"}}"); - assertEquals("OK", jsonClient.jsonMerge("test_merge", Path2.of("$"), "{\"person\":{\"age\":30}}")); + assertEquals("OK", jsonV2.jsonMerge("test_merge", Path2.of("$"), "{\"person\":{\"age\":30}}")); - assertJsonArrayEquals(jsonArray(json), jsonClient.jsonGet("test_merge", Path2.of("$"))); + assertJsonArrayEquals(jsonArray(json), jsonV2.jsonGet("test_merge", Path2.of("$"))); // Test with root path path $.a.b - assertEquals("OK", jsonClient.jsonMerge("test_merge", Path2.of("$.person.address"), "{\"work\":\"Redis office\"}")); + assertEquals("OK", jsonV2.jsonMerge("test_merge", Path2.of("$.person.address"), "{\"work\":\"Redis office\"}")); json = new JSONObject("{\"person\":{\"name\":\"John Doe\",\"age\":30,\"address\":{\"home\":\"123 Main Street\",\"work\":\"Redis office\"},\"phone\":\"123-456-7890\"}}"); - assertJsonArrayEquals(jsonArray(json), jsonClient.jsonGet("test_merge", Path2.of("$"))); + assertJsonArrayEquals(jsonArray(json), jsonV2.jsonGet("test_merge", Path2.of("$"))); // Test with null value to delete a value - assertEquals("OK", jsonClient.jsonMerge("test_merge", Path2.of("$.person"), "{\"age\":null}")); + assertEquals("OK", jsonV2.jsonMerge("test_merge", Path2.of("$.person"), "{\"age\":null}")); json = new JSONObject("{\"person\":{\"name\":\"John Doe\",\"address\":{\"home\":\"123 Main Street\",\"work\":\"Redis office\"},\"phone\":\"123-456-7890\"}}"); - assertJsonArrayEquals(jsonArray(json), jsonClient.jsonGet("test_merge", Path2.of("$"))); + assertJsonArrayEquals(jsonArray(json), jsonV2.jsonGet("test_merge", Path2.of("$"))); // cleanup assertEquals(1L, client.del("test_merge")); @@ -221,25 +245,25 @@ public void testJsonMergeArray() { // Test merge on an array JSONObject json = new JSONObject("{\"a\":{\"b\":{\"c\":[\"d\",\"e\"]}}}"); - assertEquals("OK", jsonClient.jsonSet("test_merge_array", Path2.of("$"), json)); - assertEquals("OK", jsonClient.jsonMerge("test_merge_array", Path2.of("$.a.b.c"), "[\"f\"]")); + assertEquals("OK", jsonV2.jsonSet("test_merge_array", Path2.of("$"), json)); + assertEquals("OK", jsonV2.jsonMerge("test_merge_array", Path2.of("$.a.b.c"), "[\"f\"]")); json = new JSONObject("{\"a\":{\"b\":{\"c\":[\"f\"]}}}"); - assertJsonArrayEquals(jsonArray(json), jsonClient.jsonGet("test_merge_array", Path2.of("$"))); + assertJsonArrayEquals(jsonArray(json), jsonV2.jsonGet("test_merge_array", Path2.of("$"))); // assertEquals("{{a={b={c=[f]}}}", jsonClient.jsonGet("test_merge_array", Path2.of("$"))); // Test merge an array on a value - assertEquals("OK", jsonClient.jsonSet("test_merge_array", Path2.of("$"), "{\"a\":{\"b\":{\"c\":\"d\"}}}")); - assertEquals("OK", jsonClient.jsonMerge("test_merge_array", Path2.of("$.a.b.c"), "[\"f\"]")); + assertEquals("OK", jsonV2.jsonSet("test_merge_array", Path2.of("$"), "{\"a\":{\"b\":{\"c\":\"d\"}}}")); + assertEquals("OK", jsonV2.jsonMerge("test_merge_array", Path2.of("$.a.b.c"), "[\"f\"]")); json = new JSONObject("{\"a\":{\"b\":{\"c\":[\"f\"]}}}"); - assertJsonArrayEquals(jsonArray(json), jsonClient.jsonGet("test_merge_array", Path2.of("$"))); + assertJsonArrayEquals(jsonArray(json), jsonV2.jsonGet("test_merge_array", Path2.of("$"))); // Test with null value to delete an array value - assertEquals("OK", jsonClient.jsonSet("test_merge_array", Path2.of("$"), "{\"a\":{\"b\":{\"c\":[\"d\",\"e\"]}}}")); - assertEquals("OK", jsonClient.jsonMerge("test_merge_array", Path2.of("$.a.b"), "{\"c\":null}")); + assertEquals("OK", jsonV2.jsonSet("test_merge_array", Path2.of("$"), "{\"a\":{\"b\":{\"c\":[\"d\",\"e\"]}}}")); + assertEquals("OK", jsonV2.jsonMerge("test_merge_array", Path2.of("$.a.b"), "{\"c\":null}")); json = new JSONObject("{\"a\":{\"b\":{}}}"); - assertJsonArrayEquals(jsonArray(json), jsonClient.jsonGet("test_merge_array", Path2.of("$"))); + assertJsonArrayEquals(jsonArray(json), jsonV2.jsonGet("test_merge_array", Path2.of("$"))); } @Test @@ -249,10 +273,10 @@ public void mgetWithPathWithAllKeysExist() { Qux qux1 = new Qux("quux1", "corge1", "garply1", baz1); Qux qux2 = new Qux("quux2", "corge2", "garply2", baz2); - jsonClient.jsonSet("qux1", new JSONObject(gson.toJson(qux1))); - jsonClient.jsonSet("qux2", new JSONObject(gson.toJson(qux2))); + jsonV2.jsonSet("qux1", new JSONObject(gson.toJson(qux1))); + jsonV2.jsonSet("qux2", new JSONObject(gson.toJson(qux2))); - List list = jsonClient.jsonMGet(Path2.of("baz"), "qux1", "qux2"); + List list = jsonV2.jsonMGet(Path2.of("baz"), "qux1", "qux2"); assertEquals(2, list.size()); assertJsonArrayEquals(jsonArray(new JSONObject(gson.toJson(baz1))), list.get(0)); assertJsonArrayEquals(jsonArray(new JSONObject(gson.toJson(baz2))), list.get(1)); @@ -265,10 +289,10 @@ public void mgetAtRootPathWithMissingKeys() { Qux qux1 = new Qux("quux1", "corge1", "garply1", baz1); Qux qux2 = new Qux("quux2", "corge2", "garply2", baz2); - jsonClient.jsonSetWithEscape("qux1", qux1); - jsonClient.jsonSetWithEscape("qux2", qux2); + jsonV2.jsonSetWithEscape("qux1", qux1); + jsonV2.jsonSetWithEscape("qux2", qux2); - List list = jsonClient.jsonMGet("qux1", "qux2", "qux3"); + List list = jsonV2.jsonMGet("qux1", "qux2", "qux3"); assertEquals(3, list.size()); assertNull(list.get(2)); @@ -278,24 +302,24 @@ public void mgetAtRootPathWithMissingKeys() { @Test public void arrLen() { - jsonClient.jsonSet("arr", ROOT_PATH, new JSONArray(new int[]{0, 1, 2, 3, 4})); - assertEquals(singletonList(5L), jsonClient.jsonArrLen("arr", ROOT_PATH)); + jsonV2.jsonSet("arr", ROOT_PATH, new JSONArray(new int[]{0, 1, 2, 3, 4})); + assertEquals(singletonList(5L), jsonV2.jsonArrLen("arr", ROOT_PATH)); } @Test public void clearArray() { - jsonClient.jsonSet("foobar", ROOT_PATH, gson.toJson(new FooBarObject())); + jsonV2.jsonSet("foobar", ROOT_PATH, gson.toJson(new FooBarObject())); Path2 arrPath = Path2.of(".fooArr"); - assertEquals(singletonList(3L), jsonClient.jsonArrLen("foobar", arrPath)); + assertEquals(singletonList(3L), jsonV2.jsonArrLen("foobar", arrPath)); - assertEquals(1L, jsonClient.jsonClear("foobar", arrPath)); - assertEquals(singletonList(0L), jsonClient.jsonArrLen("foobar", arrPath)); + assertEquals(1L, jsonV2.jsonClear("foobar", arrPath)); + assertEquals(singletonList(0L), jsonV2.jsonArrLen("foobar", arrPath)); // ignore non-array Path2 strPath = Path2.of(".foo"); - assertEquals(0L, jsonClient.jsonClear("foobar", strPath)); - assertJsonArrayEquals(jsonArray("bar"), jsonClient.jsonGet("foobar", strPath)); + assertEquals(0L, jsonV2.jsonClear("foobar", strPath)); + assertJsonArrayEquals(jsonArray("bar"), jsonV2.jsonGet("foobar", strPath)); } @Test @@ -303,22 +327,22 @@ public void clearObject() { Baz baz = new Baz("quuz", "grault", "waldo"); Qux qux = new Qux("quux", "corge", "garply", baz); - jsonClient.jsonSet("qux", gson.toJson(qux)); + jsonV2.jsonSet("qux", gson.toJson(qux)); Path2 objPath = Path2.of(".baz"); // assertEquals(baz, jsonClient.jsonGet("qux", objPath)); - assertEquals(1L, jsonClient.jsonClear("qux", objPath)); + assertEquals(1L, jsonV2.jsonClear("qux", objPath)); // assertEquals(new Baz(null, null, null), jsonClient.jsonGet("qux", objPath)); - assertJsonArrayEquals(jsonArray(new JSONObject()), jsonClient.jsonGet("qux", objPath)); + assertJsonArrayEquals(jsonArray(new JSONObject()), jsonV2.jsonGet("qux", objPath)); } @Test public void arrAppendSameType() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; - jsonClient.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); - assertEquals(singletonList(6L), jsonClient.jsonArrAppend("test_arrappend", Path2.of(".b"), 4, 5, 6)); + jsonV2.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); + assertEquals(singletonList(6L), jsonV2.jsonArrAppend("test_arrappend", Path2.of(".b"), 4, 5, 6)); - assertJsonArrayEquals(jsonArray(jsonArray(1, 2, 3, 4, 5, 6)), jsonClient.jsonGet("test_arrappend", Path2.of(".b"))); + assertJsonArrayEquals(jsonArray(jsonArray(1, 2, 3, 4, 5, 6)), jsonV2.jsonGet("test_arrappend", Path2.of(".b"))); } @Test @@ -327,173 +351,158 @@ public void arrAppendMultipleTypes() { Object trueObject = gson.toJson(true); Object nullObject = gson.toJson(null); String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; - jsonClient.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); - assertEquals(singletonList(6L), jsonClient.jsonArrAppend("test_arrappend", Path2.of(".b"), fooObject, trueObject, nullObject)); + jsonV2.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); + assertEquals(singletonList(6L), jsonV2.jsonArrAppend("test_arrappend", Path2.of(".b"), fooObject, trueObject, nullObject)); - assertJsonArrayEquals(jsonArray(jsonArray(1, 2, 3, "foo", true, null)), jsonClient.jsonGet("test_arrappend", Path2.of(".b"))); + assertJsonArrayEquals(jsonArray(jsonArray(1, 2, 3, "foo", true, null)), jsonV2.jsonGet("test_arrappend", Path2.of(".b"))); } @Test public void arrAppendMultipleTypesWithDeepPath() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; - jsonClient.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); - assertEquals(singletonList(4L), jsonClient.jsonArrAppendWithEscape("test_arrappend", Path2.of(".c.d"), "foo", true, null)); + jsonV2.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); + assertEquals(singletonList(4L), jsonV2.jsonArrAppendWithEscape("test_arrappend", Path2.of(".c.d"), "foo", true, null)); - assertJsonArrayEquals(jsonArray(jsonArray("ello", "foo", true, null)), jsonClient.jsonGet("test_arrappend", Path2.of(".c.d"))); + assertJsonArrayEquals(jsonArray(jsonArray("ello", "foo", true, null)), jsonV2.jsonGet("test_arrappend", Path2.of(".c.d"))); } @Test public void arrAppendAgaintsEmptyArray() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: [] }}"; - jsonClient.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); - assertEquals(singletonList(3L), jsonClient.jsonArrAppendWithEscape("test_arrappend", Path2.of(".c.d"), "a", "b", "c")); + jsonV2.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); + assertEquals(singletonList(3L), jsonV2.jsonArrAppendWithEscape("test_arrappend", Path2.of(".c.d"), "a", "b", "c")); - assertJsonArrayEquals(jsonArray(jsonArray("a", "b", "c")), jsonClient.jsonGet("test_arrappend", Path2.of(".c.d"))); + assertJsonArrayEquals(jsonArray(jsonArray("a", "b", "c")), jsonV2.jsonGet("test_arrappend", Path2.of(".c.d"))); } @Test public void arrAppendPathIsNotArray() { String json = "{ a: 'hello', b: [1, 2, 3], c: { d: ['ello'] }}"; - jsonClient.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); - assertEquals(singletonList(null), jsonClient.jsonArrAppend("test_arrappend", Path2.of(".a"), 1)); - assertEquals(singletonList(null), jsonClient.jsonArrAppend("test_arrappend", Path2.of(".a"), gson.toJson(1))); - assertEquals(singletonList(null), jsonClient.jsonArrAppendWithEscape("test_arrappend", Path2.of(".a"), 1)); + jsonV2.jsonSet("test_arrappend", ROOT_PATH, new JSONObject(json)); + assertEquals(singletonList(null), jsonV2.jsonArrAppend("test_arrappend", Path2.of(".a"), 1)); + assertEquals(singletonList(null), jsonV2.jsonArrAppend("test_arrappend", Path2.of(".a"), gson.toJson(1))); + assertEquals(singletonList(null), jsonV2.jsonArrAppendWithEscape("test_arrappend", Path2.of(".a"), 1)); } @Test(expected = JedisDataException.class) public void arrIndexAbsentKey() { - jsonClient.jsonArrIndexWithEscape("quxquux", ROOT_PATH, new JSONObject()); + jsonV2.jsonArrIndexWithEscape("quxquux", ROOT_PATH, new JSONObject()); } @Test public void arrIndexWithInts() { - jsonClient.jsonSetWithEscape("quxquux", ROOT_PATH, new int[]{8, 6, 7, 5, 3, 0, 9}); - assertEquals(singletonList(2L), jsonClient.jsonArrIndexWithEscape("quxquux", ROOT_PATH, 7)); - assertEquals(singletonList(-1L), jsonClient.jsonArrIndexWithEscape("quxquux", ROOT_PATH, "7")); + jsonV2.jsonSetWithEscape("quxquux", ROOT_PATH, new int[]{8, 6, 7, 5, 3, 0, 9}); + assertEquals(singletonList(2L), jsonV2.jsonArrIndexWithEscape("quxquux", ROOT_PATH, 7)); + assertEquals(singletonList(-1L), jsonV2.jsonArrIndexWithEscape("quxquux", ROOT_PATH, "7")); } @Test public void arrIndexWithStrings() { - jsonClient.jsonSetWithEscape("quxquux", ROOT_PATH, new String[]{"8", "6", "7", "5", "3", "0", "9"}); - assertEquals(singletonList(2L), jsonClient.jsonArrIndexWithEscape("quxquux", ROOT_PATH, "7")); + jsonV2.jsonSetWithEscape("quxquux", ROOT_PATH, new String[]{"8", "6", "7", "5", "3", "0", "9"}); + assertEquals(singletonList(2L), jsonV2.jsonArrIndexWithEscape("quxquux", ROOT_PATH, "7")); } @Test public void arrIndexWithStringsAndPath() { - jsonClient.jsonSetWithEscape("foobar", ROOT_PATH, new FooBarObject()); - assertEquals(singletonList(1L), jsonClient.jsonArrIndexWithEscape("foobar", Path2.of(".fooArr"), "b")); + jsonV2.jsonSetWithEscape("foobar", ROOT_PATH, new FooBarObject()); + assertEquals(singletonList(1L), jsonV2.jsonArrIndexWithEscape("foobar", Path2.of(".fooArr"), "b")); } @Test public void arrIndexNonExistentPath() { - jsonClient.jsonSet("foobar", ROOT_PATH, gson.toJson(new FooBarObject())); - assertEquals(Collections.emptyList(), jsonClient.jsonArrIndex("foobar", Path2.of(".barArr"), gson.toJson("x"))); + jsonV2.jsonSet("foobar", ROOT_PATH, gson.toJson(new FooBarObject())); + assertEquals(Collections.emptyList(), jsonV2.jsonArrIndex("foobar", Path2.of(".barArr"), gson.toJson("x"))); } @Test public void arrInsert() { String json = "['hello', 'world', true, 1, 3, null, false]"; - jsonClient.jsonSet("test_arrinsert", ROOT_PATH, new JSONArray(json)); - assertEquals(singletonList(8L), jsonClient.jsonArrInsertWithEscape("test_arrinsert", ROOT_PATH, 1, "foo")); + jsonV2.jsonSet("test_arrinsert", ROOT_PATH, new JSONArray(json)); + assertEquals(singletonList(8L), jsonV2.jsonArrInsertWithEscape("test_arrinsert", ROOT_PATH, 1, "foo")); assertJsonArrayEquals(jsonArray(jsonArray("hello", "foo", "world", true, 1, 3, null, false)), - jsonClient.jsonGet("test_arrinsert", ROOT_PATH)); + jsonV2.jsonGet("test_arrinsert", ROOT_PATH)); } @Test public void arrInsertWithNegativeIndex() { String json = "['hello', 'world', true, 1, 3, null, false]"; - jsonClient.jsonSet("test_arrinsert", ROOT_PATH, new JSONArray(json)); - assertEquals(singletonList(8L), jsonClient.jsonArrInsertWithEscape("test_arrinsert", ROOT_PATH, -1, "foo")); + jsonV2.jsonSet("test_arrinsert", ROOT_PATH, new JSONArray(json)); + assertEquals(singletonList(8L), jsonV2.jsonArrInsertWithEscape("test_arrinsert", ROOT_PATH, -1, "foo")); assertJsonArrayEquals(jsonArray(jsonArray("hello", "world", true, 1, 3, null, "foo", false)), - jsonClient.jsonGet("test_arrinsert", ROOT_PATH)); + jsonV2.jsonGet("test_arrinsert", ROOT_PATH)); } @Test public void arrPop() { - jsonClient.jsonSet("arr", ROOT_PATH, new JSONArray(new int[]{0, 1, 2, 3, 4})); - assertEquals(singletonList(4d), jsonClient.jsonArrPop("arr", ROOT_PATH)); - assertEquals(singletonList(3d), jsonClient.jsonArrPop("arr", ROOT_PATH, -1)); - assertEquals(singletonList(0d), jsonClient.jsonArrPop("arr", ROOT_PATH, 0)); + jsonV2.jsonSet("arr", ROOT_PATH, new JSONArray(new int[]{0, 1, 2, 3, 4})); + assertEquals(singletonList(4d), jsonV2.jsonArrPop("arr", ROOT_PATH)); + assertEquals(singletonList(3d), jsonV2.jsonArrPop("arr", ROOT_PATH, -1)); + assertEquals(singletonList(0d), jsonV2.jsonArrPop("arr", ROOT_PATH, 0)); } @Test public void arrTrim() { // jsonClient.jsonSet("arr", ROOT_PATH, new int[]{0, 1, 2, 3, 4}); - jsonClient.jsonSet("arr", ROOT_PATH, new JSONArray(new int[]{0, 1, 2, 3, 4})); - assertEquals(singletonList(3L), jsonClient.jsonArrTrim("arr", ROOT_PATH, 1, 3)); + jsonV2.jsonSet("arr", ROOT_PATH, new JSONArray(new int[]{0, 1, 2, 3, 4})); + assertEquals(singletonList(3L), jsonV2.jsonArrTrim("arr", ROOT_PATH, 1, 3)); // assertArrayEquals(new Integer[]{1, 2, 3}, jsonClient.jsonGet("arr", Integer[].class, ROOT_PATH)); - assertJsonArrayEquals(jsonArray(jsonArray(1, 2, 3)), jsonClient.jsonGet("arr", ROOT_PATH)); + assertJsonArrayEquals(jsonArray(jsonArray(1, 2, 3)), jsonV2.jsonGet("arr", ROOT_PATH)); } @Test public void strAppend() { // jsonClient.jsonSet("str", ROOT_PATH, "foo"); - jsonClient.jsonSet("str", ROOT_PATH, gson.toJson("foo")); - assertEquals(singletonList(6L), jsonClient.jsonStrAppend("str", ROOT_PATH, "bar")); - assertEquals("foobar", jsonClient.jsonGet("str")); + jsonV2.jsonSet("str", ROOT_PATH, gson.toJson("foo")); + assertEquals(singletonList(6L), jsonV2.jsonStrAppend("str", ROOT_PATH, "bar")); + assertJsonArrayEquals(jsonArray("foobar"), jsonV2.jsonGet("str", ROOT_PATH)); } @Test public void strLen() { - jsonClient.jsonSetWithEscape("str", "foobar"); - assertEquals(singletonList(6L), jsonClient.jsonStrLen("str", ROOT_PATH)); + jsonV2.jsonSetWithEscape("str", "foobar"); + assertEquals(singletonList(6L), jsonV2.jsonStrLen("str", ROOT_PATH)); } @Test public void numIncrBy() { - jsonClient.jsonSet("doc", "{\"a\":\"b\",\"b\":[{\"a\":2}, {\"a\":5}, {\"a\":\"c\"}]}"); - assertJsonArrayEquals(jsonArray((Object) null), jsonClient.jsonNumIncrBy("doc", Path2.of(".a"), 1d)); - assertJsonArrayEquals(jsonArray(null, 4, 7, null), jsonClient.jsonNumIncrBy("doc", Path2.of("..a"), 2d)); - assertJsonArrayEquals(jsonArray((Object) null), jsonClient.jsonNumIncrBy("doc", Path2.of("..b"), 0d)); - assertJsonArrayEquals(jsonArray(), jsonClient.jsonNumIncrBy("doc", Path2.of("..c"), 0d)); + Assume.assumeFalse(RedisProtocolUtil.getRedisProtocol() == RedisProtocol.RESP3); + jsonV2.jsonSet("doc", "{\"a\":\"b\",\"b\":[{\"a\":2}, {\"a\":5}, {\"a\":\"c\"}]}"); + assertJsonArrayEquals(jsonArray((Object) null), jsonV2.jsonNumIncrBy("doc", Path2.of(".a"), 1d)); + assertJsonArrayEquals(jsonArray(null, 4, 7, null), jsonV2.jsonNumIncrBy("doc", Path2.of("..a"), 2d)); + assertJsonArrayEquals(jsonArray((Object) null), jsonV2.jsonNumIncrBy("doc", Path2.of("..b"), 0d)); + assertJsonArrayEquals(jsonArray(), jsonV2.jsonNumIncrBy("doc", Path2.of("..c"), 0d)); } @Test - public void obj() { - String json = "{\"a\":[3], \"nested\": {\"a\": {\"b\":2, \"c\": 1}}}"; - jsonClient.jsonSet("doc", ROOT_PATH, json); - assertEquals(Arrays.asList(2L), jsonClient.jsonObjLen("doc", ROOT_PATH)); - assertEquals(Arrays.asList(Arrays.asList("a", "nested")), jsonClient.jsonObjKeys("doc", ROOT_PATH)); - assertEquals(Arrays.asList(null, 2L), jsonClient.jsonObjLen("doc", Path2.of("..a"))); - assertEquals(Arrays.asList(null, Arrays.asList("b", "c")), jsonClient.jsonObjKeys("doc", Path2.of("..a"))); + public void numIncrByResp3() { + Assume.assumeTrue(RedisProtocolUtil.getRedisProtocol() == RedisProtocol.RESP3); + jsonV2.jsonSet("doc", "{\"a\":\"b\",\"b\":[{\"a\":2}, {\"a\":5}, {\"a\":\"c\"}]}"); + assertEquals(singletonList((Object) null), jsonV2.jsonNumIncrBy("doc", Path2.of(".a"), 1d)); + assertEquals(Arrays.asList(null, 4d, 7d, null), jsonV2.jsonNumIncrBy("doc", Path2.of("..a"), 2d)); + assertEquals(singletonList((Object) null), jsonV2.jsonNumIncrBy("doc", Path2.of("..b"), 0d)); + assertEquals(Collections.emptyList(), jsonV2.jsonNumIncrBy("doc", Path2.of("..c"), 0d)); } @Test - public void debugMemory() { - assertEquals(Collections.emptyList(), jsonClient.jsonDebugMemory("json", ROOT_PATH)); - - jsonClient.jsonSet("json", new JSONObject("{ foo: 'bar', bar: { foo: 10 }}")); - assertEquals(1, jsonClient.jsonDebugMemory("json", ROOT_PATH).size()); - assertEquals(2, jsonClient.jsonDebugMemory("json", Path2.of("$..foo")).size()); - assertEquals(1, jsonClient.jsonDebugMemory("json", Path2.of("$..bar")).size()); + public void obj() { + String json = "{\"a\":[3], \"nested\": {\"a\": {\"b\":2, \"c\": 1}}}"; + jsonV2.jsonSet("doc", ROOT_PATH, json); + assertEquals(Arrays.asList(2L), jsonV2.jsonObjLen("doc", ROOT_PATH)); + assertEquals(Arrays.asList(Arrays.asList("a", "nested")), jsonV2.jsonObjKeys("doc", ROOT_PATH)); + assertEquals(Arrays.asList(null, 2L), jsonV2.jsonObjLen("doc", Path2.of("..a"))); + assertEquals(Arrays.asList(null, Arrays.asList("b", "c")), jsonV2.jsonObjKeys("doc", Path2.of("..a"))); } @Test - public void resp() { - assertNull(jsonClient.jsonResp("resp", ROOT_PATH)); - - String json = "{\"foo\": {\"hello\":\"world\"}, \"bar\": [null, 3, 2.5, true]}"; - jsonClient.jsonSet("resp", ROOT_PATH, json); - - List> fullResp = jsonClient.jsonResp("resp", ROOT_PATH); - assertEquals(1, fullResp.size()); - - List resp = fullResp.get(0); - assertEquals("{", resp.get(0)); - - assertEquals("foo", resp.get(1)); - assertEquals(Arrays.asList("{", "hello", "world"), resp.get(2)); + public void debugMemory() { + assertEquals(Collections.emptyList(), jsonV2.jsonDebugMemory("json", ROOT_PATH)); - assertEquals("bar", resp.get(3)); - List arr = (List) resp.get(4); - assertEquals("[", arr.get(0)); - assertNull(arr.get(1)); - assertEquals(Long.valueOf(3), arr.get(2)); - //assertEquals("2.5", arr.get(3)); - MatcherAssert.assertThat(arr.get(3), Matchers.isOneOf("2.5", 2.5)); - assertEquals("true", arr.get(4)); + jsonV2.jsonSet("json", new JSONObject("{ foo: 'bar', bar: { foo: 10 }}")); + assertEquals(1, jsonV2.jsonDebugMemory("json", ROOT_PATH).size()); + assertEquals(2, jsonV2.jsonDebugMemory("json", Path2.of("$..foo")).size()); + assertEquals(1, jsonV2.jsonDebugMemory("json", Path2.of("$..bar")).size()); } private void assertJsonArrayEquals(JSONArray a, Object _b) { diff --git a/src/test/java/redis/clients/jedis/modules/search/AggregationBuilderTest.java b/src/test/java/redis/clients/jedis/modules/search/AggregationBuilderTest.java new file mode 100644 index 0000000000..396ca3365e --- /dev/null +++ b/src/test/java/redis/clients/jedis/modules/search/AggregationBuilderTest.java @@ -0,0 +1,28 @@ +package redis.clients.jedis.modules.search; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.junit.Test; + +import redis.clients.jedis.search.aggr.Reducer; +import redis.clients.jedis.search.aggr.Reducers; + +public class AggregationBuilderTest { + + @Test + public void reducerObject() { + Reducer reducer = Reducers.sum("@count").as("total"); + assertEquals("SUM", reducer.getName()); + assertEquals("@count", reducer.getField()); + assertEquals("total", reducer.getAlias()); + } + + @Test + public void countObject() { + Reducer count = Reducers.count(); + assertEquals("COUNT", count.getName()); + assertNull(count.getField()); + assertNull(count.getAlias()); + } +} diff --git a/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java b/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java index 14f210ae8a..b594f28dd1 100644 --- a/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java @@ -11,11 +11,14 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import redis.clients.jedis.RedisProtocol; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.search.Document; import redis.clients.jedis.search.FieldName; @@ -27,6 +30,7 @@ import redis.clients.jedis.search.aggr.Row; import redis.clients.jedis.search.aggr.SortedField; import redis.clients.jedis.modules.RedisModuleCommandsTestBase; +import redis.clients.jedis.search.FTProfileParams; import redis.clients.jedis.search.aggr.FtAggregateIteration; import redis.clients.jedis.search.schemafields.NumericField; import redis.clients.jedis.search.schemafields.TextField; @@ -123,6 +127,52 @@ public void testAggregations2() { assertEquals("10", rows.get(1).get("sum")); } + @Test + public void testAggregations2Profile() { + Schema sc = new Schema(); + sc.addSortableTextField("name", 1.0); + sc.addSortableNumericField("count"); + client.ftCreate(index, IndexOptions.defaultOptions(), sc); + + addDocument(new Document("data1").set("name", "abc").set("count", 10)); + addDocument(new Document("data2").set("name", "def").set("count", 5)); + addDocument(new Document("data3").set("name", "def").set("count", 25)); + + AggregationBuilder aggr = new AggregationBuilder() + .groupBy("@name", Reducers.sum("@count").as("sum")) + .sortBy(10, SortedField.desc("@sum")); + + Map.Entry> reply + = client.ftProfileAggregate(index, FTProfileParams.profileParams(), aggr); + + // actual search + AggregationResult result = reply.getKey(); + assertEquals(2, result.getTotalResults()); + + List rows = result.getRows(); + assertEquals("def", rows.get(0).get("name")); + assertEquals("30", rows.get(0).get("sum")); + assertNull(rows.get(0).get("nosuchcol")); + + assertEquals("abc", rows.get(1).get("name")); + assertEquals("10", rows.get(1).get("sum")); + + // profile + Map profile = reply.getValue(); + + assertEquals(Arrays.asList("Index", "Grouper", "Sorter"), + ((List>) profile.get("Result processors profile")).stream() + .map(map -> map.get("Type")).collect(Collectors.toList())); + + if (protocol != RedisProtocol.RESP3) { + assertEquals("WILDCARD", ((Map) profile.get("Iterators profile")).get("Type")); + } else { + assertEquals(Arrays.asList("WILDCARD"), + ((List>) profile.get("Iterators profile")).stream() + .map(map -> map.get("Type")).collect(Collectors.toList())); + } + } + @Test public void testAggregationBuilderVerbatim() { Schema sc = new Schema(); diff --git a/src/test/java/redis/clients/jedis/modules/search/QueryBuilderTest.java b/src/test/java/redis/clients/jedis/modules/search/QueryBuilderTest.java index a63b625f50..7f152f8985 100644 --- a/src/test/java/redis/clients/jedis/modules/search/QueryBuilderTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/QueryBuilderTest.java @@ -91,10 +91,10 @@ public void testIntersectionBasic() { @Test public void testIntersectionNested() { - Node n = intersect(). - add(union("name", value("mark"), value("dvir"))). - add("time", between(100, 200)). - add(disjunct("created", lt(1000))); + Node n = intersect() + .add(union("name", value("mark"), value("dvir"))) + .add("time", between(100, 200)) + .add(disjunct("created", lt(1000))); assertEquals("(@name:(mark|dvir) @time:[100 200] -@created:[-inf (1000])", n.toString()); } diff --git a/src/test/java/redis/clients/jedis/modules/search/SearchConfigTest.java b/src/test/java/redis/clients/jedis/modules/search/SearchConfigTest.java index b180711cc7..bda3cbe4d1 100644 --- a/src/test/java/redis/clients/jedis/modules/search/SearchConfigTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/SearchConfigTest.java @@ -5,10 +5,8 @@ import java.util.Collections; import java.util.Map; - import org.junit.BeforeClass; import org.junit.Test; - import redis.clients.jedis.modules.RedisModuleCommandsTestBase; public class SearchConfigTest extends RedisModuleCommandsTestBase { @@ -25,12 +23,14 @@ public static void prepare() { @Test public void config() { - Map map = client.ftConfigGet("TIMEOUT"); + Map map = client.ftConfigGet("TIMEOUT"); assertEquals(1, map.size()); - String value = map.get("TIMEOUT"); - assertNotNull(value); - - assertEquals("OK", client.ftConfigSet("timeout", value)); + String value = (String) map.get("TIMEOUT"); + try { + assertNotNull(value); + } finally { + assertEquals("OK", client.ftConfigSet("timeout", value)); + } } @Test @@ -38,11 +38,14 @@ public void configOnTimeout() { // confirm default assertEquals(Collections.singletonMap("ON_TIMEOUT", "return"), client.ftConfigGet("ON_TIMEOUT")); - assertEquals("OK", client.ftConfigSet("ON_TIMEOUT", "fail")); - assertEquals(Collections.singletonMap("ON_TIMEOUT", "fail"), client.ftConfigGet("ON_TIMEOUT")); + try { + assertEquals("OK", client.ftConfigSet("ON_TIMEOUT", "fail")); + assertEquals(Collections.singletonMap("ON_TIMEOUT", "fail"), client.ftConfigGet("ON_TIMEOUT")); - // restore to default - assertEquals("OK", client.ftConfigSet("ON_TIMEOUT", "return")); + } finally { + // restore to default + assertEquals("OK", client.ftConfigSet("ON_TIMEOUT", "return")); + } } @Test @@ -50,10 +53,13 @@ public void dialectConfig() { // confirm default assertEquals(Collections.singletonMap("DEFAULT_DIALECT", "1"), client.ftConfigGet("DEFAULT_DIALECT")); - assertEquals("OK", client.ftConfigSet("DEFAULT_DIALECT", "2")); - assertEquals(Collections.singletonMap("DEFAULT_DIALECT", "2"), client.ftConfigGet("DEFAULT_DIALECT")); + try { + assertEquals("OK", client.ftConfigSet("DEFAULT_DIALECT", "2")); + assertEquals(Collections.singletonMap("DEFAULT_DIALECT", "2"), client.ftConfigGet("DEFAULT_DIALECT")); - // restore to default - assertEquals("OK", client.ftConfigSet("DEFAULT_DIALECT", "1")); + } finally { + // restore to default + assertEquals("OK", client.ftConfigSet("DEFAULT_DIALECT", "1")); + } } } diff --git a/src/test/java/redis/clients/jedis/modules/search/SearchTest.java b/src/test/java/redis/clients/jedis/modules/search/SearchTest.java index c36c3db2ca..b8656ff344 100644 --- a/src/test/java/redis/clients/jedis/modules/search/SearchTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/SearchTest.java @@ -3,10 +3,13 @@ import static org.junit.Assert.*; import java.util.*; +import java.util.stream.Collectors; import org.hamcrest.Matchers; +import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; +import redis.clients.jedis.RedisProtocol; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.json.Path; import redis.clients.jedis.search.*; @@ -155,11 +158,6 @@ public void alterAdd() throws Exception { } SearchResult res2 = client.ftSearch(index, new Query("@tags:{tagA}")); assertEquals(100, res2.getTotalResults()); - - Map info = client.ftInfo(index); - assertEquals(index, info.get("index_name")); - assertEquals("identifier", ((List) ((List) info.get("attributes")).get(1)).get(0)); - assertEquals("attribute", ((List) ((List) info.get("attributes")).get(1)).get(2)); } @Test @@ -373,8 +371,13 @@ public void testQueryFlags() throws Exception { res = client.ftSearch(index, q); for (Document d : res.getDocuments()) { assertTrue(d.getId().startsWith("doc")); - assertEquals(1.0, d.getScore(), 0); - assertNull(d.get("title")); + if (protocol != RedisProtocol.RESP3) { + assertEquals(1.0, d.getScore(), 0); + assertNull(d.get("title")); + } else { + assertNull(d.getScore()); + assertThrows(NullPointerException.class, () -> d.get("title")); + } } // test verbatim vs. stemming @@ -644,8 +647,13 @@ public void info() throws Exception { Map info = client.ftInfo(index); assertEquals(index, info.get("index_name")); assertEquals(6, ((List) info.get("attributes")).size()); - assertEquals("global_idle", ((List) info.get("cursor_stats")).get(0)); - assertEquals(0L, ((List) info.get("cursor_stats")).get(1)); + if (protocol != RedisProtocol.RESP3) { + assertEquals("global_idle", ((List) info.get("cursor_stats")).get(0)); + assertEquals(0L, ((List) info.get("cursor_stats")).get(1)); + } else { + assertEquals(0L, ((Map) info.get("cursor_stats")).get("global_idle")); + assertEquals(128L, ((Map) info.get("cursor_stats")).get("index_capacity")); + } } @Test @@ -892,6 +900,8 @@ public void inKeys() throws Exception { @Test public void blobField() throws Exception { + Assume.assumeFalse(protocol == RedisProtocol.RESP3); // not supporting + Schema sc = new Schema().addTextField("field1", 1.0); assertEquals("OK", client.ftCreate(index, IndexOptions.defaultOptions(), sc)); @@ -1123,6 +1133,43 @@ public void testDialectsWithFTExplain() throws Exception { assertTrue("Should contain '{K=10 nearest vector'", client.ftExplain(index, query).contains("{K=10 nearest vector")); } + @Test + public void searchProfile() { + Schema sc = new Schema().addTextField("t1", 1.0).addTextField("t2", 1.0); + assertEquals("OK", client.ftCreate(index, IndexOptions.defaultOptions(), sc)); + + Map hash = new HashMap<>(); + hash.put("t1", "foo"); + hash.put("t2", "bar"); + client.hset("doc1", hash); + + Map.Entry> reply = client.ftProfileSearch(index, + FTProfileParams.profileParams(), new Query("foo")); + + SearchResult result = reply.getKey(); + assertEquals(1, result.getTotalResults()); + assertEquals(Collections.singletonList("doc1"), result.getDocuments().stream().map(Document::getId).collect(Collectors.toList())); + + Map profile = reply.getValue(); + Map iteratorsProfile; + if (protocol != RedisProtocol.RESP3) { + iteratorsProfile = (Map) profile.get("Iterators profile"); + } else { + List iteratorsProfileList = (List) profile.get("Iterators profile"); + assertEquals(1, iteratorsProfileList.size()); + iteratorsProfile = (Map) iteratorsProfileList.get(0); + } + assertEquals("TEXT", iteratorsProfile.get("Type")); + assertEquals("foo", iteratorsProfile.get("Term")); + assertEquals(1L, iteratorsProfile.get("Counter")); + assertEquals(1L, iteratorsProfile.get("Size")); + assertSame(Double.class, iteratorsProfile.get("Time").getClass()); + + assertEquals(Arrays.asList("Index", "Scorer", "Sorter", "Loader"), + ((List>) profile.get("Result processors profile")).stream() + .map(map -> map.get("Type")).collect(Collectors.toList())); + } + @Test public void testHNSWVVectorSimilarity() { Map attr = new HashMap<>(); @@ -1147,13 +1194,18 @@ public void testHNSWVVectorSimilarity() { assertEquals("0", doc1.get("__v_score")); // profile - Map.Entry> profile + Map.Entry> reply = client.ftProfileSearch(index, FTProfileParams.profileParams(), query); - doc1 = profile.getKey().getDocuments().get(0); + doc1 = reply.getKey().getDocuments().get(0); assertEquals("a", doc1.getId()); assertEquals("0", doc1.get("__v_score")); - Map iteratorsProfile = (Map) profile.getValue().get("Iterators profile"); - assertEquals("VECTOR", iteratorsProfile.get("Type")); + if (protocol != RedisProtocol.RESP3) { + assertEquals("VECTOR", ((Map) reply.getValue().get("Iterators profile")).get("Type")); + } else { + assertEquals(Arrays.asList("VECTOR"), + ((List>) reply.getValue().get("Iterators profile")).stream() + .map(map -> map.get("Type")).collect(Collectors.toList())); + } } @Test @@ -1180,34 +1232,18 @@ public void testFlatVectorSimilarity() { assertEquals("0", doc1.get("__v_score")); // profile - Map.Entry> profile + Map.Entry> reply = client.ftProfileSearch(index, FTProfileParams.profileParams(), query); - doc1 = profile.getKey().getDocuments().get(0); + doc1 = reply.getKey().getDocuments().get(0); assertEquals("a", doc1.getId()); assertEquals("0", doc1.get("__v_score")); - Map iteratorsProfile = (Map) profile.getValue().get("Iterators profile"); - assertEquals("VECTOR", iteratorsProfile.get("Type")); - } - - @Test - public void searchProfile() { - Schema sc = new Schema().addTextField("t1", 1.0).addTextField("t2", 1.0); - assertEquals("OK", client.ftCreate(index, IndexOptions.defaultOptions(), sc)); - - Map map = new HashMap<>(); - map.put("t1", "foo"); - map.put("t2", "bar"); - client.hset("doc1", map); - - Map.Entry> profile = client.ftProfileSearch(index, - FTProfileParams.profileParams(), new Query("foo")); - // Iterators profile={Type=TEXT, Time=0.0, Term=foo, Counter=1, Size=1} - Map iteratorsProfile = (Map) profile.getValue().get("Iterators profile"); - assertEquals("TEXT", iteratorsProfile.get("Type")); - assertEquals("foo", iteratorsProfile.get("Term")); - assertEquals(1L, iteratorsProfile.get("Counter")); - assertEquals(1L, iteratorsProfile.get("Size")); - assertSame(Double.class, iteratorsProfile.get("Time").getClass()); + if (protocol != RedisProtocol.RESP3) { + assertEquals("VECTOR", ((Map) reply.getValue().get("Iterators profile")).get("Type")); + } else { + assertEquals(Arrays.asList("VECTOR"), + ((List>) reply.getValue().get("Iterators profile")).stream() + .map(map -> map.get("Type")).collect(Collectors.toList())); + } } @Test diff --git a/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java b/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java index bcdee83679..a81ceb7821 100644 --- a/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java @@ -1,15 +1,25 @@ package redis.clients.jedis.modules.search; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.*; import static redis.clients.jedis.util.AssertUtil.assertOK; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import org.hamcrest.Matchers; import org.junit.BeforeClass; import org.junit.Test; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.Point; +import org.locationtech.jts.geom.Polygon; +import org.locationtech.jts.io.ParseException; +import org.locationtech.jts.io.WKTReader; + import redis.clients.jedis.GeoCoordinate; +import redis.clients.jedis.RedisProtocol; import redis.clients.jedis.args.GeoUnit; import redis.clients.jedis.args.SortingOrder; import redis.clients.jedis.exceptions.JedisDataException; @@ -163,11 +173,6 @@ public void alterAdd() { } SearchResult res2 = client.ftSearch(index, "@tags:{tagA}"); assertEquals(100, res2.getTotalResults()); - - Map info = client.ftInfo(index); - assertEquals(index, info.get("index_name")); - assertEquals("identifier", ((List) ((List) info.get("attributes")).get(1)).get(0)); - assertEquals("attribute", ((List) ((List) info.get("attributes")).get(1)).get(2)); } @Test @@ -337,6 +342,100 @@ public void geoFilterAndGeoCoordinateObject() { assertEquals(2, res.getTotalResults()); } + @Test + public void geoShapeFilterSpherical() throws ParseException { + final WKTReader reader = new WKTReader(); + final GeometryFactory factory = new GeometryFactory(); + + assertOK(client.ftCreate(index, GeoShapeField.of("geom", GeoShapeField.CoordinateSystem.SPHERICAL))); + + // polygon type + final Polygon small = factory.createPolygon(new Coordinate[]{new Coordinate(34.9001, 29.7001), + new Coordinate(34.9001, 29.7100), new Coordinate(34.9100, 29.7100), + new Coordinate(34.9100, 29.7001), new Coordinate(34.9001, 29.7001)}); + client.hset("small", "geom", small.toString()); + + final Polygon large = factory.createPolygon(new Coordinate[]{new Coordinate(34.9001, 29.7001), + new Coordinate(34.9001, 29.7200), new Coordinate(34.9200, 29.7200), + new Coordinate(34.9200, 29.7001), new Coordinate(34.9001, 29.7001)}); + client.hset("large", "geom", large.toString()); + + // within condition + final Polygon within = factory.createPolygon(new Coordinate[]{new Coordinate(34.9000, 29.7000), + new Coordinate(34.9000, 29.7150), new Coordinate(34.9150, 29.7150), + new Coordinate(34.9150, 29.7000), new Coordinate(34.9000, 29.7000)}); + + SearchResult res = client.ftSearch(index, "@geom:[within $poly]", + FTSearchParams.searchParams().addParam("poly", within).dialect(3)); + assertEquals(1, res.getTotalResults()); + assertEquals(1, res.getDocuments().size()); + assertEquals(small, reader.read(res.getDocuments().get(0).getString("geom"))); + + // contains condition + final Polygon contains = factory.createPolygon(new Coordinate[]{new Coordinate(34.9002, 29.7002), + new Coordinate(34.9002, 29.7050), new Coordinate(34.9050, 29.7050), + new Coordinate(34.9050, 29.7002), new Coordinate(34.9002, 29.7002)}); + + res = client.ftSearch(index, "@geom:[contains $poly]", + FTSearchParams.searchParams().addParam("poly", contains).dialect(3)); + assertEquals(2, res.getTotalResults()); + assertEquals(2, res.getDocuments().size()); + + // point type + final Point point = factory.createPoint(new Coordinate(34.9010, 29.7010)); + client.hset("point", "geom", point.toString()); + + res = client.ftSearch(index, "@geom:[within $poly]", + FTSearchParams.searchParams().addParam("poly", within).dialect(3)); + assertEquals(2, res.getTotalResults()); + assertEquals(2, res.getDocuments().size()); + } + + @Test + public void geoShapeFilterFlat() throws ParseException { + final WKTReader reader = new WKTReader(); + final GeometryFactory factory = new GeometryFactory(); + + assertOK(client.ftCreate(index, GeoShapeField.of("geom", GeoShapeField.CoordinateSystem.FLAT))); + + // polygon type + final Polygon small = factory.createPolygon(new Coordinate[]{new Coordinate(1, 1), + new Coordinate(1, 100), new Coordinate(100, 100), new Coordinate(100, 1), new Coordinate(1, 1)}); + client.hset("small", "geom", small.toString()); + + final Polygon large = factory.createPolygon(new Coordinate[]{new Coordinate(1, 1), + new Coordinate(1, 200), new Coordinate(200, 200), new Coordinate(200, 1), new Coordinate(1, 1)}); + client.hset("large", "geom", large.toString()); + + // within condition + final Polygon within = factory.createPolygon(new Coordinate[]{new Coordinate(0, 0), + new Coordinate(0, 150), new Coordinate(150, 150), new Coordinate(150, 0), new Coordinate(0, 0)}); + + SearchResult res = client.ftSearch(index, "@geom:[within $poly]", + FTSearchParams.searchParams().addParam("poly", within).dialect(3)); + assertEquals(1, res.getTotalResults()); + assertEquals(1, res.getDocuments().size()); + assertEquals(small, reader.read(res.getDocuments().get(0).getString("geom"))); + + // contains condition + final Polygon contains = factory.createPolygon(new Coordinate[]{new Coordinate(2, 2), + new Coordinate(2, 50), new Coordinate(50, 50), new Coordinate(50, 2), new Coordinate(2, 2)}); + + res = client.ftSearch(index, "@geom:[contains $poly]", + FTSearchParams.searchParams().addParam("poly", contains).dialect(3)); + assertEquals(2, res.getTotalResults()); + assertEquals(2, res.getDocuments().size()); + + // point type + final Point point = factory.createPoint(new Coordinate(10, 10)); + client.hset("point", "geom", point.toString()); + + res = client.ftSearch(index, "@geom:[within $poly]", + FTSearchParams.searchParams().addParam("poly", within).dialect(3)); + assertEquals(2, res.getTotalResults()); + assertEquals(2, res.getDocuments().size()); + } + @Test public void testQueryFlags() { assertOK(client.ftCreate(index, TextField.of("title"))); @@ -371,8 +470,13 @@ public void testQueryFlags() { FTSearchParams.searchParams().noContent()); for (Document d : res.getDocuments()) { assertTrue(d.getId().startsWith("doc")); - assertEquals(1.0, d.getScore(), 0); - assertNull(d.get("title")); + if (protocol != RedisProtocol.RESP3) { + assertEquals(1.0, d.getScore(), 0); + assertNull(d.get("title")); + } else { + assertNull(d.getScore()); + assertThrows(NullPointerException.class, () -> d.get("title")); + } } // test verbatim vs. stemming @@ -566,8 +670,12 @@ public void info() { Map info = client.ftInfo(index); assertEquals(index, info.get("index_name")); assertEquals(6, ((List) info.get("attributes")).size()); - assertEquals("global_idle", ((List) info.get("cursor_stats")).get(0)); - assertEquals(0L, ((List) info.get("cursor_stats")).get(1)); + if (protocol != RedisProtocol.RESP3) { + assertEquals("global_idle", ((List) info.get("cursor_stats")).get(0)); + assertEquals(0L, ((List) info.get("cursor_stats")).get(1)); + } else { + assertEquals(0L, ((Map) info.get("cursor_stats")).get("global_idle")); + } } @Test @@ -945,20 +1053,36 @@ public void testFlatVectorSimilarity() { public void searchProfile() { assertOK(client.ftCreate(index, TextField.of("t1"), TextField.of("t2"))); - Map map = new HashMap<>(); - map.put("t1", "foo"); - map.put("t2", "bar"); - client.hset("doc1", map); + Map hash = new HashMap<>(); + hash.put("t1", "foo"); + hash.put("t2", "bar"); + client.hset("doc1", hash); - Map.Entry> profile = client.ftProfileSearch(index, + Map.Entry> reply = client.ftProfileSearch(index, FTProfileParams.profileParams(), "foo", FTSearchParams.searchParams()); - // Iterators profile={Type=TEXT, Time=0.0, Term=foo, Counter=1, Size=1} - Map iteratorsProfile = (Map) profile.getValue().get("Iterators profile"); + + SearchResult result = reply.getKey(); + assertEquals(1, result.getTotalResults()); + assertEquals(Collections.singletonList("doc1"), result.getDocuments().stream().map(Document::getId).collect(Collectors.toList())); + + Map profile = reply.getValue(); + Map iteratorsProfile; + if (protocol != RedisProtocol.RESP3) { + iteratorsProfile = (Map) profile.get("Iterators profile"); + } else { + List iteratorsProfileList = (List) profile.get("Iterators profile"); + assertEquals(1, iteratorsProfileList.size()); + iteratorsProfile = (Map) iteratorsProfileList.get(0); + } assertEquals("TEXT", iteratorsProfile.get("Type")); assertEquals("foo", iteratorsProfile.get("Term")); assertEquals(1L, iteratorsProfile.get("Counter")); assertEquals(1L, iteratorsProfile.get("Size")); assertSame(Double.class, iteratorsProfile.get("Time").getClass()); + + assertEquals(Arrays.asList("Index", "Scorer", "Sorter", "Loader"), + ((List>) profile.get("Result processors profile")).stream() + .map(map -> map.get("Type")).collect(Collectors.toList())); } @Test @@ -976,109 +1100,140 @@ public void vectorSearchProfile() { FTSearchParams searchParams = FTSearchParams.searchParams().addParam("vec", "aaaaaaaa") .sortBy("__v_score", SortingOrder.ASC).noContent().dialect(2); - Map.Entry> profile = client.ftProfileSearch(index, + Map.Entry> reply = client.ftProfileSearch(index, FTProfileParams.profileParams(), "*=>[KNN 3 @v $vec]", searchParams); - assertEquals(3, profile.getKey().getTotalResults()); + assertEquals(3, reply.getKey().getTotalResults()); - assertEquals(Arrays.asList(4, 2, 1).toString(), profile.getKey().getDocuments() + assertEquals(Arrays.asList(4, 2, 1).toString(), reply.getKey().getDocuments() .stream().map(Document::getId).collect(Collectors.toList()).toString()); - Map iteratorsProfile = (Map) profile.getValue().get("Iterators profile"); - assertEquals("VECTOR", iteratorsProfile.get("Type")); - assertEquals(3L, iteratorsProfile.get("Counter")); + Map profile = reply.getValue(); - List> resultProcessorsProfile = (List>) profile.getValue().get("Result processors profile"); - // assertEquals("Vector Similarity Scores Loader", resultProcessorsProfile.get(1).get("Type")); // Changed to "Metrics Applier" - assertEquals(3l, resultProcessorsProfile.get(1).get("Counter")); + if (protocol != RedisProtocol.RESP3) { + assertEquals("VECTOR", ((Map) profile.get("Iterators profile")).get("Type")); + } else { + assertEquals(Arrays.asList("VECTOR"), + ((List>) profile.get("Iterators profile")).stream() + .map(map -> map.get("Type")).collect(Collectors.toList())); + } + + List> resultProcessorsProfile + = (List>) reply.getValue().get("Result processors profile"); + assertEquals(3, resultProcessorsProfile.size()); + assertEquals("Index", resultProcessorsProfile.get(0).get("Type")); + assertEquals("Sorter", resultProcessorsProfile.get(2).get("Type")); } @Test public void maxPrefixExpansionSearchProfile() { final String configParam = "MAXPREFIXEXPANSIONS"; - String configValue = client.ftConfigGet(configParam).get(configParam); - client.ftConfigSet(configParam, "2"); - - assertOK(client.ftCreate(index, TextField.of("t"))); - client.hset("1", Collections.singletonMap("t", "foo1")); - client.hset("2", Collections.singletonMap("t", "foo2")); - client.hset("3", Collections.singletonMap("t", "foo3")); - - Map.Entry> profile = client.ftProfileSearch(index, - FTProfileParams.profileParams(), "foo*", FTSearchParams.searchParams().limit(0, 0)); - // Warning=Max prefix expansion reached - Map iteratorsProfile = (Map) profile.getValue().get("Iterators profile"); - assertEquals("Max prefix expansion reached", iteratorsProfile.get("Warning")); - - client.ftConfigSet(configParam, configValue); + String configValue = (String) client.ftConfigGet(configParam).get(configParam); + try { + client.ftConfigSet(configParam, "2"); + + assertOK(client.ftCreate(index, TextField.of("t"))); + client.hset("1", "t", "foo1"); + client.hset("2", "t", "foo2"); + client.hset("3", "t", "foo3"); + + Map.Entry> reply = client.ftProfileSearch(index, + FTProfileParams.profileParams(), "foo*", FTSearchParams.searchParams().limit(0, 0)); + // Warning=Max prefix expansion reached + if (protocol != RedisProtocol.RESP3) { + assertEquals("Max prefix expansion reached", + ((Map) reply.getValue().get("Iterators profile")).get("Warning")); + } else { + assertEquals("Max prefix expansion reached", + ((Map) ((List) reply.getValue().get("Iterators profile")).get(0)).get("Warning")); + } + } finally { + client.ftConfigSet(configParam, configValue); + } } @Test - public void notIteratorSearchProfile() { + public void noContentSearchProfile() { assertOK(client.ftCreate(index, TextField.of("t"))); - client.hset("1", Collections.singletonMap("t", "foo")); - client.hset("2", Collections.singletonMap("t", "bar")); + client.hset("1", "t", "foo"); + client.hset("2", "t", "bar"); Map.Entry> profile = client.ftProfileSearch(index, FTProfileParams.profileParams(), "foo -@t:baz", FTSearchParams.searchParams().noContent()); - Map depth0 = (Map) profile.getValue().get("Iterators profile"); + Map depth0 = protocol != RedisProtocol.RESP3 + ? (Map) profile.getValue().get("Iterators profile") + : ((List>) profile.getValue().get("Iterators profile")).get(0); + assertEquals("INTERSECT", depth0.get("Type")); List> depth0_children = (List>) depth0.get("Child iterators"); assertEquals("TEXT", depth0_children.get(0).get("Type")); Map depth1 = depth0_children.get(1); assertEquals("NOT", depth1.get("Type")); - List> depth1_children = (List>) depth1.get("Child iterators"); - assertEquals(1, depth1_children.size()); - assertEquals("EMPTY", depth1_children.get(0).get("Type")); + if (protocol != RedisProtocol.RESP3) { + List> depth1_children = (List>) depth1.get("Child iterators"); + assertEquals(1, depth1_children.size()); + assertEquals("EMPTY", depth1_children.get(0).get("Type")); + } else { + assertEquals("EMPTY", ((Map) depth1.get("Child iterator")).get("Type")); + } } @Test public void deepReplySearchProfile() { assertOK(client.ftCreate(index, TextField.of("t"))); - client.hset("1", Collections.singletonMap("t", "hello")); - client.hset("2", Collections.singletonMap("t", "world")); + client.hset("1", "t", "hello"); + client.hset("2", "t", "world"); Map.Entry> profile = client.ftProfileSearch(index, FTProfileParams.profileParams(), "hello(hello(hello(hello(hello(hello)))))", FTSearchParams.searchParams().noContent()); - Map depth0 = (Map) profile.getValue().get("Iterators profile"); - assertEquals("INTERSECT", depth0.get("Type")); - List> depth0_children = (List>) depth0.get("Child iterators"); - assertEquals("TEXT", depth0_children.get(0).get("Type")); - Map depth1 = depth0_children.get(1); - assertEquals("INTERSECT", depth1.get("Type")); - List> depth1_children = (List>) depth1.get("Child iterators"); - assertEquals("TEXT", depth1_children.get(0).get("Type")); - Map depth2 = depth1_children.get(1); - assertEquals("INTERSECT", depth2.get("Type")); - List> depth2_children = (List>) depth2.get("Child iterators"); - assertEquals("TEXT", depth2_children.get(0).get("Type")); - Map depth3 = depth2_children.get(1); - assertEquals("INTERSECT", depth3.get("Type")); - List> depth3_children = (List>) depth3.get("Child iterators"); - assertEquals("TEXT", depth3_children.get(0).get("Type")); - Map depth4 = depth3_children.get(1); - assertEquals("INTERSECT", depth4.get("Type")); - List> depth4_children = (List>) depth4.get("Child iterators"); - assertEquals("TEXT", depth4_children.get(0).get("Type")); - Map depth5 = depth4_children.get(1); - assertEquals("TEXT", depth5.get("Type")); - assertNull(depth5.get("Child iterators")); + Map depth0 = protocol != RedisProtocol.RESP3 + ? (Map) profile.getValue().get("Iterators profile") + : ((List>) profile.getValue().get("Iterators profile")).get(0); + + AtomicInteger intersectLevelCount = new AtomicInteger(); + AtomicInteger textLevelCount = new AtomicInteger(); + deepReplySearchProfile_assertProfile(depth0, intersectLevelCount, textLevelCount); + assertThat(intersectLevelCount.get(), Matchers.greaterThan(0)); + assertThat(textLevelCount.get(), Matchers.greaterThan(0)); + } + + private void deepReplySearchProfile_assertProfile(Map attr, + AtomicInteger intersectLevelCount, AtomicInteger textLevelCount) { + + String type = (String) attr.get("Type"); + assertThat(type, Matchers.not(Matchers.blankOrNullString())); + + switch (type) { + case "INTERSECT": + assertThat(attr, Matchers.hasKey("Child iterators")); + intersectLevelCount.incrementAndGet(); + deepReplySearchProfile_assertProfile((Map) ((List) attr.get("Child iterators")).get(0), + intersectLevelCount, textLevelCount); + break; + case "TEXT": + assertThat(attr, Matchers.hasKey("Term")); + textLevelCount.incrementAndGet(); + break; + } } @Test public void limitedSearchProfile() { assertOK(client.ftCreate(index, TextField.of("t"))); - client.hset("1", Collections.singletonMap("t", "hello")); - client.hset("2", Collections.singletonMap("t", "hell")); - client.hset("3", Collections.singletonMap("t", "help")); - client.hset("4", Collections.singletonMap("t", "helowa")); + client.hset("1", "t", "hello"); + client.hset("2", "t", "hell"); + client.hset("3", "t", "help"); + client.hset("4", "t", "helowa"); Map.Entry> profile = client.ftProfileSearch(index, FTProfileParams.profileParams().limited(), "%hell% hel*", FTSearchParams.searchParams().noContent()); - Map depth0 = (Map) profile.getValue().get("Iterators profile"); + Map depth0 = protocol != RedisProtocol.RESP3 + ? (Map) profile.getValue().get("Iterators profile") + : ((List>) profile.getValue().get("Iterators profile")).get(0); + assertEquals("INTERSECT", depth0.get("Type")); assertEquals(3L, depth0.get("Counter")); @@ -1087,15 +1242,19 @@ public void limitedSearchProfile() { for (Map depth1 : depth0_children) { assertEquals("UNION", depth1.get("Type")); assertNotNull(depth1.get("Query type")); - List depth1_children = (List) depth1.get("Child iterators"); - assertEquals(1, depth1_children.size()); - assertSame(String.class, depth1_children.get(0).getClass()); + if (protocol != RedisProtocol.RESP3) { + List depth1_children = (List) depth1.get("Child iterators"); + assertEquals(1, depth1_children.size()); + assertSame(String.class, depth1_children.get(0).getClass()); + } else { + assertSame(String.class, depth1.get("Child iterators").getClass()); + } } } @Test public void list() { - assertEquals(Collections.emptyList(), client.ftList()); + assertEquals(Collections.emptySet(), client.ftList()); final int count = 20; Set names = new HashSet<>(); @@ -1104,7 +1263,7 @@ public void list() { assertOK(client.ftCreate(name, TextField.of("t" + i))); names.add(name); } - assertEquals(names, new HashSet<>(client.ftList())); + assertEquals(names, client.ftList()); } @Test @@ -1157,4 +1316,44 @@ public void searchIterationCollect() { "pupil:4444", "student:5555", "teacher:6666").stream().collect(Collectors.toSet()), collect.stream().map(Document::getId).collect(Collectors.toSet())); } + + @Test + public void escapeUtil() { + assertOK(client.ftCreate(index, TextField.of("txt"))); + + client.hset("doc1", "txt", RediSearchUtil.escape("hello-world")); + assertNotEquals("hello-world", client.hget("doc1", "txt")); + assertEquals("hello-world", RediSearchUtil.unescape(client.hget("doc1", "txt"))); + + SearchResult resultNoEscape = client.ftSearch(index, "hello-world"); + assertEquals(0, resultNoEscape.getTotalResults()); + + SearchResult resultEscaped = client.ftSearch(index, RediSearchUtil.escapeQuery("hello-world")); + assertEquals(1, resultEscaped.getTotalResults()); + } + + @Test + public void escapeMapUtil() { + client.hset("doc2", RediSearchUtil.toStringMap(Collections.singletonMap("txt", "hello-world"), true)); + assertNotEquals("hello-world", client.hget("doc2", "txt")); + assertEquals("hello-world", RediSearchUtil.unescape(client.hget("doc2", "txt"))); + } + + @Test + public void hsetObject() { + float[] floats = new float[]{0.2f}; + assertEquals(1L, client.hsetObject("obj", "floats", floats)); + assertArrayEquals(RediSearchUtil.toByteArray(floats), + client.hget("obj".getBytes(), "floats".getBytes())); + + GeoCoordinate geo = new GeoCoordinate(-0.441, 51.458); + Map fields = new HashMap<>(); + fields.put("title", "hello world"); + fields.put("loc", geo); + assertEquals(2L, client.hsetObject("obj", fields)); + Map stringMap = client.hgetAll("obj"); + assertEquals(3, stringMap.size()); + assertEquals("hello world", stringMap.get("title")); + assertEquals(geo.getLongitude() + "," + geo.getLatitude(), stringMap.get("loc")); + } } diff --git a/src/test/java/redis/clients/jedis/modules/search/SpellCheckTest.java b/src/test/java/redis/clients/jedis/modules/search/SpellCheckTest.java index c551b59d39..508ff4441a 100644 --- a/src/test/java/redis/clients/jedis/modules/search/SpellCheckTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/SpellCheckTest.java @@ -52,7 +52,8 @@ public void dictionary() { @Test public void dictionaryBySampleKey() { assertEquals(3L, client.ftDictAddBySampleKey(index, "dict", "foo", "bar", "hello world")); - assertEquals(new HashSet<>(Arrays.asList("foo", "bar", "hello world")), client.ftDictDumpBySampleKey(index, "dict")); + assertEquals(new HashSet<>(Arrays.asList("foo", "bar", "hello world")), + client.ftDictDumpBySampleKey(index, "dict")); assertEquals(3L, client.ftDictDelBySampleKey(index, "dict", "foo", "bar", "hello world")); assertEquals(Collections.emptySet(), client.ftDictDumpBySampleKey(index, "dict")); } @@ -61,8 +62,8 @@ public void dictionaryBySampleKey() { public void basicSpellCheck() { client.ftCreate(index, TextField.of("name"), TextField.of("body")); client.hset("doc1", toMap("name", "name1", "body", "body1")); - client.hset("doc1", toMap("name", "name2", "body", "body2")); - client.hset("doc1", toMap("name", "name2", "body", "name2")); + client.hset("doc2", toMap("name", "name2", "body", "body2")); + client.hset("doc3", toMap("name", "name2", "body", "name2")); Map> reply = client.ftSpellCheck(index, "name"); assertEquals(Collections.singleton("name"), reply.keySet()); @@ -74,7 +75,8 @@ public void crossTermDictionary() { client.ftCreate(index, TextField.of("report")); client.ftDictAdd("slang", "timmies", "toque", "toonie", "serviette", "kerfuffle", "chesterfield"); - Map> expected = Collections.singletonMap("tooni", Collections.singletonMap("toonie", 0d)); + Map> expected = Collections.singletonMap("tooni", + Collections.singletonMap("toonie", 0d)); assertEquals(expected, client.ftSpellCheck(index, "Tooni toque kerfuffle", FTSpellCheckParams.spellCheckParams().includeTerm("slang").excludeTerm("slang"))); } @@ -92,6 +94,7 @@ public void dialectBound() { JedisDataException error = Assert.assertThrows(JedisDataException.class, () -> client.ftSpellCheck(index, "Tooni toque kerfuffle", FTSpellCheckParams.spellCheckParams().dialect(0))); - MatcherAssert.assertThat(error.getMessage(), Matchers.containsString("DIALECT requires a non negative integer")); + MatcherAssert.assertThat(error.getMessage(), + Matchers.containsString("DIALECT requires a non negative integer")); } } diff --git a/src/test/java/redis/clients/jedis/modules/search/UtilTest.java b/src/test/java/redis/clients/jedis/modules/search/UtilTest.java index d63c934a37..830b52565a 100644 --- a/src/test/java/redis/clients/jedis/modules/search/UtilTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/UtilTest.java @@ -1,16 +1,32 @@ package redis.clients.jedis.modules.search; +import static org.junit.Assert.assertEquals; + import org.junit.Assert; import org.junit.Test; + import redis.clients.jedis.search.RediSearchUtil; +import redis.clients.jedis.search.schemafields.NumericField; +import redis.clients.jedis.search.schemafields.SchemaField; + public class UtilTest { @Test public void floatArrayToByteArray() { float[] floats = new float[]{0.2f}; - byte[] bytes = RediSearchUtil.ToByteArray(floats); + byte[] bytes = RediSearchUtil.toByteArray(floats); byte[] expected = new byte[]{-51, -52, 76, 62}; Assert.assertArrayEquals(expected, bytes); } + + @Test + public void getSchemaFieldName() { + SchemaField field = NumericField.of("$.num").as("num"); + + assertEquals("$.num", field.getFieldName().getName()); + assertEquals("num", field.getFieldName().getAttribute()); + + assertEquals("$.num", field.getName()); + } } diff --git a/src/test/resources/functions/keyspaceTriggers.js b/src/test/resources/functions/keyspaceTriggers.js new file mode 100644 index 0000000000..2bca56b4dc --- /dev/null +++ b/src/test/resources/functions/keyspaceTriggers.js @@ -0,0 +1,12 @@ +#!js api_version=1.0 name=keyspaceTriggers + +redis.registerKeySpaceTrigger("consumer", "", function(client, data){ + if (client.call("type", data.key) != "hash") { + // key is not a hash, do not touch it. + return; + } + // get the current time in ms + var curr_time = client.call("time")[0]; + // set '__last_updated__' with the current time value + client.call('hset', data.key, '__last_updated__', curr_time); +}); \ No newline at end of file diff --git a/src/test/resources/functions/pingpong.js b/src/test/resources/functions/pingpong.js new file mode 100644 index 0000000000..511013ce16 --- /dev/null +++ b/src/test/resources/functions/pingpong.js @@ -0,0 +1,7 @@ +#!js api_version=1.0 name=pingpong + +function answer(client, data) { + return client.call('ping'); +} + +redis.registerFunction('playPingPong', answer, {description: 'You PING, we PONG'}); \ No newline at end of file diff --git a/src/test/resources/functions/streamTriggers.js b/src/test/resources/functions/streamTriggers.js new file mode 100644 index 0000000000..9d39020d1e --- /dev/null +++ b/src/test/resources/functions/streamTriggers.js @@ -0,0 +1,14 @@ +#!js api_version=1.0 name=streamTriggers + +redis.registerStreamTrigger( + "consumer", // consumer name + "stream", // streams prefix + function(c, data) { + // callback to run on each element added to the stream + redis.log(JSON.stringify(data, (key, value) => + typeof value === 'bigint' + ? value.toString() + : value // return everything else unchanged + )); + } +); \ No newline at end of file diff --git a/src/test/resources/functions/withConfig.js b/src/test/resources/functions/withConfig.js new file mode 100644 index 0000000000..c06944864f --- /dev/null +++ b/src/test/resources/functions/withConfig.js @@ -0,0 +1,16 @@ +#!js api_version=1.0 name=withConfig + +var last_modified_field_name = "__last_modified__" + +if (redis.config.last_modified_field_name !== undefined) { + if (typeof redis.config.last_modified_field_name != 'string') { + throw "last_modified_field_name must be a string"; + } + last_modified_field_name = redis.config.last_modified_field_name +} + +redis.registerFunction("hset", function(client, key, field, val){ + // get the current time in ms + var curr_time = client.call("time")[0]; + return client.call('hset', key, field, val, last_modified_field_name, curr_time); +}); \ No newline at end of file diff --git a/src/test/resources/functions/withFlags.js b/src/test/resources/functions/withFlags.js new file mode 100644 index 0000000000..f4f9f05e1f --- /dev/null +++ b/src/test/resources/functions/withFlags.js @@ -0,0 +1,9 @@ +#!js api_version=1.0 name=withFlags +redis.registerFunction("my_set", + (c, key, val) => { + return c.call("set", key, val); + }, + { + flags: [redis.functionFlags.RAW_ARGUMENTS] + } +); \ No newline at end of file diff --git a/src/test/resources/functions/workingWIthHashes.js b/src/test/resources/functions/workingWIthHashes.js new file mode 100644 index 0000000000..6b99c51655 --- /dev/null +++ b/src/test/resources/functions/workingWIthHashes.js @@ -0,0 +1,8 @@ +#!js api_version=1.0 name=hashitout + +redis.registerFunction('hashy', function(client, key_name){ + if (client.call('type', key_name) == 'hash') { + return client.call('hgetall', key_name); + } + throw "Oops, that wasn't a Hash!"; +}); \ No newline at end of file