Giter Club home page Giter Club logo

microsphere-redis's People

Contributors

mercyblitz avatar

microsphere-redis's Issues

RedisCommandReplicator Native method implementation

把MethodHandle 存储在一个static final 的map中
再根据方法签名找到对应的Methodhandle
再用invokeWithArguments执行redis命令

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

Find Redis Write Command

通过连接RedisSever,执行ACL CAT "write"(6.0提供),可以获取所有写指令
再用反射查找出所有RedisCommands中的写方法
RedisServer(7.0)中的写指令 (108个)
lettuce CommandType中能对应到的(96个)
RedisCommands中的方法 (120个)
以下12个指令未对应上:

FUNCTION|DELETE
FUNCTION|FLUSH
FUNCTION|LOAD
FUNCTION|RESTORE
PFDEBUG
RESTORE-ASKING
XGROUP|CREATE
XGROUP|CREATECONSUMER
XGROUP|DELCONSUMER
XGROUP|DESTROY
XGROUP|SETID
XSETID

实现思路:
https://github.com/liqi19950722/redis-testcontainers/blob/master/src/test/java/io/github/fun/stuff/redis/RedisConnectionTest.java

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.