赞
踩
简述:
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
- public class JedisCache {
- // 创建Jedis存储
- private static ShardedJedis jedis;
- static {
- List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
- JedisShardInfo si = new JedisShardInfo("localhost", 6379);
- shards.add(si);
- jedis = new ShardedJedis(shards);
- }
-
-
- public static ShardedJedis getJedis(){
- return jedis;
- }
- }
- final String id = "1";
- String value = "value";
- JedisCache.getJedis().set(id, value);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。