A simple example of the Java operation Redis

Source: Internet
Author: User

Java Operations Redis is a must-learn content, then I directly on a super simple case for you to refer to the next!

First, create the Redistest class, the code is as follows!

Import Redis.clients.jedis.jedis;public class Redistest {public static void main (string[] args) {//TODO auto-        Generated method stub//Connect Redis service Jedis Jedis = new Jedis ("127.0.0.1", 6379);        Password verification-If you do not set up a redis password, you can use the relevant command//jedis.auth ("ABCDEFG") without verifying it.        Simple Key-value storage Jedis.set ("Redis2", "Myredis2");        System.out.println (Jedis.get ("Redis2"));    System.out.println (); }}

Printing results such as:


Check in the terminal to verify that it is correct:


See it! In the terminal can also be output, that is to say, our Java has successfully operation of Redis! Small partners who are not very knowledgeable about Redis can go straight to redis session.




A simple example of the Java operation Redis

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.