redis第一章
来源:互联网 发布:linux运维工程师是什么 编辑:程序博客网 时间:2024/05/20 09:25
1.首先从网站http://down.51cto.com/data/1004158 下载redis jar包,下载后,解压到某个目录下,点击redis-server.exe
2.
package com.xxx.redis;import redis.clients.jedis.Jedis;import java.util.HashMap;import java.util.List;import java.util.Map;/** * Created with IntelliJ IDEA. * Date: 14-3-2 * Time: 下午10:32 * To change this template use File | Settings | File Templates. */public class ResisDemo { private void testRedisDemo() { Jedis jedis = new Jedis("localhost", 6379, 3000); jedis.hset("zhangshan", "server1", "湖南"); jedis.hset("zhangshan", "server2", "新疆"); jedis.hset("zhangshan", "server3", "北京"); List<String> list = jedis.hmget("zhangshan", "server1", "server2", "server3"); for (String str : list) { System.out.println(str); } Map<String, String> map = new HashMap<String, String>(); map.put("username", "zhangsha"); map.put("password", "123446"); jedis.hmset("map", map); System.out.println(jedis.hget("map", "username")); Map<String,String> resultMap=jedis.hgetAll("map"); for(Map.Entry<String,String> entry:resultMap.entrySet()){ System.out.println(entry.getKey()+" "+entry.getValue()); } } public static void main(String[] args) { ResisDemo resisDemo = new ResisDemo(); resisDemo.testRedisDemo(); }}
0 0
- redis第一章
- Redis 学习第一章
- Redis快速入门第一章
- 01-redis学习第一章
- 第一章redis集群安装
- 第一章 Redis 快速入门
- 《redis实战》读书笔记-第一章:初识redis
- redis设计与实现读书笔记(第一章)
- redis使用教程原理-第一章:概述
- The Little Redis Book中文版 第一章
- (spring redis应用第一章)Spring+Redis的简单应用
- Redis Essentials 读书笔记 - 第一章: Getting Started (The Baby Steps)
- 第一章>
- 第一章
- 第一章
- 第一章
- 第一章
- 第一章
- 蓝桥杯 K好数(动态规划)
- 代理服务器基础知识
- 利用 TTL 线连上 cubieboard nano flash 上的 Android 系统
- Java知识总结-网络编程
- org.springframework.web.servlet.DispatcherServlet noHandlerFound
- redis第一章
- hwui绘制状态组织方式——Snapshot
- 代理服务器的搜索和设置
- pat:1021
- Repo和Git 版本管理常用命令
- iphone利用md5加密代码
- MySQL基本概念--锁
- 代理服务器端口分配一览表
- Binary Tree Postorder Traversal