Three Steps to Jedis connection Redis

First, the first download Redis, after decompression can be used without installation.

Here Insert Picture Description

Redis server running redis-server.exe and Redis client redis-cli.exe
Second, open the Java development tools, import jar package
commons-pool2-2.8.0.jar
jedis-3.1.0.jar
Third, the input connection code Jedis
    public void test(){
        //获取连接
        Jedis jedis = new Jedis("localhost",6379);
        //操作
        jedis.set("username","zhangsan");
        //关闭连接
        jedis.close();
    }
operation result

Here Insert Picture Description

Note: When you run Jedis connection code, the first server redis-server.exe open, otherwise it will not connect

Jar package and related tools download link: https: //blog.csdn.net/liangjiabao5555/article/details/104008439

Published 62 original articles · won praise 39 · views 120 000 +

Guess you like

Origin blog.csdn.net/liangjiabao5555/article/details/104008154