Atitit.redis操作总结

Atitit.redis操作总结

1.1. 获取redis所有kv1

1.2. dbsize:返回当前数据库中key的数目 1

1.3. 一起吧所有key列出来1

1.4. Java连接redis  jedis2.42

1.5. 参考3

 

 

1.1. 获取redis所有kv

 

edis 127.0.0.1:6379> keys '*'

1) "laravel:e08bf4c5c94bcbda225be8b1e26d8dc372b02bfc"

2) "laravel:dcea4ad1cf565361c24a1f0d9ce5d5dc6d75a617"

3) "laravel:107021e59aa1559081693573d16ff26ba43dd464"

4) "laravel:0b3d00096848cb699e3502e498932ce9b8b261eb"

 

1.2. dbsize:返回当前数据库中key的数目

4(integer) 4

 

 

 

 (2)get key:取值

  (3)mset key1 value1 key2 value2 一次设置多个值

  (4)mget key1 key2 :一次获取多个值

 

作者::  ★(attilax)>>>   绰号:老哇的爪子  全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊  汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

 

1.3. 一起吧所有key列出来

Clienet 好像吗

 

 

 

1.4. Java连接redis  jedis2.4

 

 

public static void main(String[] args) {

   JedisPool jedisPool = new JedisPool("localhost", 6379);  

        Jedis jedis = null;  

        try {  

            jedis = jedisPool.getResource();

          Set<String>  keys= jedis.keys("*");

          for (String k : keys) {

System.out.println(k);

System.out.println(jedis.get(k));

System.out.println("----");

}

          //  jedis.set("rediskey1", "redisvalue1");  

         //   jedis.set("rediskey2", "redisvalue2");  

          //  System.out.println(jedis.get("rediskey1"));  

       //     System.out.println(jedis.get("rediskey2"));  

        } catch (Exception e) {  

            e.printStackTrace();  

        } finally {  

            if (jedis != null)  

                jedis.close();  

        }  

        jedisPool.destroy();  

    }  

 

laravel:dcea4ad1cf565361c24a1f0d9ce5d5dc6d75a617

s:259:"a:4:{s:6:"_token";s:40:"9Usg7qwXhb9FM1pTQQ03fQKuBkFCJ6Nh24s3Hvqc";s:9:"_previous";a:1:{s:3:"url";s:22:"http://localhost/login";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}s:9:"_sf2_meta";a:3:{s:1:"u";i:1462097843;s:1:"c";i:1462053172;s:1:"l";s:1:"0";}}";

----

laravel:e08bf4c5c94bcbda225be8b1e26d8dc372b02bfc

s:197:"a:3:{s:6:"_token";s:40:"MaPWKKWQuD8vumtRzixZr2kDWIo6wXkySudZU96L";s:9:"_sf2_meta";a:3:{s:1:"u";i:1462097999;s:1:"c";i:1462097999;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}";

----

laravel:0b3d00096848cb699e3502e498932ce9b8b261eb

s:553:"a:7:{s:6:"_token";s:40:"hDtPrNGYaLJ37JuF6mnMtaboEggoRFXQJUQyK1Dv";s:5:"flash";a:2:{s:3:"new";a:0:{}s:3:"old";a:0:{}}s:9:"_previous";a:1:{s:3:"url";s:53:"http://localhost/u/NzI0MTE2MDcyQHFxLmNvbQ==/f-success";}s:38:"login_82e5d2c56bdd0811318f0cf078b78bfc";i:170;s:8:"firsturl";s:139:"http://localhost/form/active/1703011462098053/1?key=%242y%2410%24w2moUOw5G5fMyBRS0nlVWe71fGbGnDIq8XxQXRZQxhLnkl8pzSKkC×tamp=1462098067";s:11:"previousUrl";s:21:"http://localhost/form";s:9:"_sf2_meta";a:3:{s:1:"u";i:1462098131;s:1:"c";i:1462097995;s:1:"l";s:1:"0";}}";

----

laravel:107021e59aa1559081693573d16ff26ba43dd464

s:197:"a:3:{s:6:"_token";s:40:"eIcd2CQnviCwZT8yCuNsW6d9DE7zcYiCTBOa2G1N";s:9:"_sf2_meta";a:3:{s:1:"u";i:1462097993;s:1:"c";i:1462097993;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}";

----

 

1.5. 参考

redis常用命令小结_Redis_脚本之家.htm

 

 

redis-cli 命令总结 - YHL27的专栏 - 博客频道 - CSDN.NET.html

 

posted @ 2016-05-01 23:48  attilaxAti  阅读(339)  评论(0编辑  收藏  举报