-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support automatic namespacing (#3781)
* Proof-of-concept for automatic key prefixing * Iteration on key-prefixing POC - Demonstrated automatic key-prefixing for all subclasses of UnifiedJedis: JedisCluster, JedisPooled, and JedisSentineled - Key-prefixing is possible as long as the underlying CommandObjects can be customized. - CommandObjects cannot use commandArguments in its constructor since in the specific case of key-prefixing, commandArguments depends on the child constructor running first. So we lose caching of argument-less CommandObjects. - Based on this POC, the minimum changes required to jedis would be: - public constructors that allow UnifiedJedis and its subclasses to take a custom CommandObjects. - Consistent use of supplied CommandObjects throughout code (e.g. in Pipeline, Transaction, etc). - Removal of caching of argument-less CommandObjects in the constructor of CommandObjects. - Applications can then supply CommandObjects with custom behavior as necessary. Sample classes that implement the behavior of prefixed keys, etc are provided but these can be supplied by the application as long as required constructors are available. * Second iteration on key-prefixing POC - Restore cached key-less commands in CommandObjects - Support Transactions - New constructors do not take CommandExecutor - Requested JavaDoc regarding new constructors specifying RedisProtocol - New classes moved into 'prefix' packages - De-duplicate prefixing code * Support automatic key prefixing by handler interface --------- Co-authored-by: R-J Lim <[email protected]>
- Loading branch information
Showing
17 changed files
with
316 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/redis/clients/jedis/CommandKeyArgumentPreProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package redis.clients.jedis; | ||
|
||
import redis.clients.jedis.annots.Experimental; | ||
|
||
@Experimental | ||
public interface CommandKeyArgumentPreProcessor { | ||
|
||
/** | ||
* @param paramKey key name in application | ||
* @return key name in Redis server | ||
*/ | ||
Object actualKey(Object paramKey); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.