Java common commands used Jedis connection Redis operate on List

Scenes

Download and install Centos compile Redis in the (ultra-detailed):

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103967334

Redis startup and shutdown (foreground and background start start):

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103972348

RedisDesktopManager client visualization tool to download and install and use:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103983147

Java is used Jedis connected to common commands Redis Key operating:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/104915569

Key with reference to the rear face of a command operation, the following is a List common operations.

Note:

Blog:
https://blog.csdn.net/badao_liumang_qizhi
public concern number of
programs overbearing ape
acquisition-related programming e-books, tutorials and push for free download.

achieve

New Junit method TestList, then open the code comments

    @Test
     public  void TestList () 
    { 
        // add a List
         // jedis.lpush ( "Animals", "Dog", "CAT", "Pig", "FISH", "Bird");
         // the System.out. the println ( "Get all the elements in the set of animals:" + jedis.lrange ( "animals", 0, -1));
         // System.out.println ( "Get set 0 to animals penultimate element:" jedis.lrange + ( "Animals", 0, -2));
         // delete the specified value, the number of the second element is removed, the add value to go is deleted, similar to the stack
         // the System. out.println ( "remove elements other than subscript 0-3 range:" + jedis.ltrim ( "Animals", 0, 1));
         // System.out.println ( "Animals list of the stack (right): "+ jedis.rpop (" animals ")
         );// System.out.println ( "modify the contents of the specified index animals 1:" + jedis.lset ( "animals"
         , 1, "badao"));// System.out.println ( "Get the length of the animals:" + jedis.llen ( "animals")); 
        the System. OUT .println ( " Get element animals subscript 2: " + jedis.lindex ( " animals " , 2 )); 
    }

 

Guess you like

Origin www.cnblogs.com/badaoliumangqizhi/p/12524929.html