1, window under the Redis installation
Address: https://github.com/MSOpenTech/redis/releases
Download redis-x64-3.2.100.msi or redis-x64-3.2.100.zip are available
2, click on the file to install, after installation to find Redis installation directory, cmd switch to the installation directory
CD C:\Program Files\redis
3, Start Redis
CMD run the following command, the following interface appears to indicate the success of the start service
Redis-server.exe redis.windows.conf
4. Write Java code
Introduction of the Package: Jedis-2.9.0.jar, download path: Http://central.maven.org/maven2/redis/clients/jedis/2.9.0/jedis-2.9.0.jar
Import Redis.clients.jedis.Jedis;
public class Testredis {
/**
* @param args
*/
TODO auto-generated Method Stub
public static void Main (string[] args) {
Connecting to the local Redis service
Connecting to the local Redis service
Jedis Jedis = new Jedis ("localhost");
System.out.println ("Connection to Server sucessfully");
Set Redis string data
Jedis.set ("TestKey", "TestValue");
Gets the stored data and outputs
System.out.println ("TestKey corresponding value" + Jedis.get ("TestKey"));
}
}
The following are the results of the operation