🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### POM文件 ```xml <?xml version="1.0" encoding="UTF-8"?> <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.gosuncn</groupId> <artifactId>Jedis</artifactId> <version>1.0-Pluto</version> <dependencies> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>3.2.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build> </project> ``` ### 测试类`JedisTest`文件 ```java package com.gosuncn; import redis.clients.jedis.Jedis; import java.util.UUID; public class JedisTest { public static void main(String[] args) { Jedis jedis = new Jedis("192.168.1.98", 6379); String token = jedis.setex("token", 5, UUID.randomUUID().toString()); System.out.println(token); jedis.close(); } } ```