Redis之Java客户端Jedis

导读

  • Redis不仅使用命令客户端来操作,而且可以使用程序客户端操作。
  • 现在基本上主流的语言都有客户端支持,比如Java、C、C#、C++、php、Node.js、Go等。
  • 在官方网站里列一些Java的客户端,有Jedis、Redisson、Jredis、JDBC-Redis等,其中官方推荐使用Jedis和Redisson。
  • 在企业中用的最多的就是Jedis
  • Jedis同样也是托管在github上,地址:https://github.com/xetorthio/jedis

linux 关闭防火墙

具体在liunx上如何配置Redis,请参考:

 service iptables stop   命令关闭防火墙,但是系统重启后会开启

 chkconfig iptables off--关闭防火墙开机自启动

 修改:redis.conf配置文件

Maven项目搭建

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.cyb</groupId>
    <artifactId>RedisDemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.9.0</version>
        </dependency>
    </dependencies>
</project>

测试

猜你喜欢

转载自www.cnblogs.com/chenyanbin/p/12088796.html