Open liqi19950722 opened 7 months ago
把MethodHandle 存储在一个static final 的map中 再根据方法签名找到对应的Methodhandle 再用invokeWithArguments执行redis命令
invokeWithArguments
Object[] args = new Object[3]; args[0] = connection.stringCommands(); args[1] = "key".getBytes(StandardCharsets.UTF_8); args[2] = "value".getBytes(StandardCharsets.UTF_8); methodhandle.invokeWithArguments(args);
https://github.com/liqi19950722/redis-testcontainers/blob/master/src/main/java/io/github/fun/stuff/redis/RedisCommandsMethodHandles.java
https://github.com/liqi19950722/redis-testcontainers/blob/master/src/test/java/io/github/fun/stuff/redis/RedisConnectionTest.java
jmh Benchmark: https://github.com/liqi19950722/fun-stuff-reflect
Please Pull request!
把MethodHandle 存储在一个static final 的map中 再根据方法签名找到对应的Methodhandle 再用
invokeWithArguments
执行redis命令https://github.com/liqi19950722/redis-testcontainers/blob/master/src/main/java/io/github/fun/stuff/redis/RedisCommandsMethodHandles.java
https://github.com/liqi19950722/redis-testcontainers/blob/master/src/test/java/io/github/fun/stuff/redis/RedisConnectionTest.java
jmh Benchmark: https://github.com/liqi19950722/fun-stuff-reflect