Redis installation, Java simple application

Source: Internet
Author: User

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




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.