设为首页 加入收藏

TOP

CentOS 7下Redis5安装部署与开机自启动(三)
2019-07-05 18:10:48 】 浏览:159
Tags:CentOS Redis5 安装 部署 开机 启动
379);
        //调用jedis对象的方法,方法名称和redis的命令一致。
        jedis.set("key1", "jedis test");
        String str = jedis.get("key1");
        System.out.println(str);
        //关闭jedis。
        jedis.close();
    }
   
    /**
    * 使用连接池
    */
    @Test
    public void testJedisPool() {
        //创建jedis连接池
        JedisPool pool = new JedisPool("172.20.10.7", 6379);
        //从连接池中获得Jedis对象
        Jedis jedis = pool.getResource();
        String str = jedis.get("key1");
        System.out.println(str);
        //关闭jedis对象
        jedis.close();
        pool.close();
    }
}


至此redis安装配置完毕。


good luck !


首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇CentOS 7下Redis5集群的搭建和使用 下一篇MySQL数据库的基本使用

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目