当前位置:   article > 正文

redis java配置_myeclipse配置redis

myeclipse配置redis

简述:

redis后台仓储配置


步骤:

1. 下载后台service压缩文件

https://github.com/dmajkic/redis/downloads


2. java所需的jar包

https://github.com/xetorthio/jedis/downloads


3. 下载后,打开server.exe



3. 此时会出现一个cmmand面板,让这个command开着



4. 在代码中实际测试,默认端口6379

  1. public class JedisCache {
  2. // 创建Jedis存储
  3. private static ShardedJedis jedis;
  4. static {
  5. List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
  6. JedisShardInfo si = new JedisShardInfo("localhost", 6379);
  7. shards.add(si);
  8. jedis = new ShardedJedis(shards);
  9. }
  10. public static ShardedJedis getJedis(){
  11. return jedis;
  12. }
  13. }


插入jedis的map中(string, string)

  1. final String id = "1";
  2. String value = "value";
  3. JedisCache.getJedis().set(id, value);



本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号