windows - redis内存对象使用
来源:互联网 发布:家里网络能连上但没网 编辑:程序博客网 时间:2024/06/18 11:43
一、下载Redis
- 下载Redis并解压缩https://redis.io/download
- 在解压文件夹开启命令行。
G:\Software\redis-64.3.0.503>redis-server.exe redis.windows.conf _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.0.503 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 3836 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-'[3836] 29 Nov 16:39:12.287 # Server started, Redis version 3.0.503[3836] 29 Nov 16:39:12.301 * DB loaded from disk: 0.006 seconds[3836] 29 Nov 16:39:12.303 * The server is now ready to accept connections on port 6379
二、测试简单读取写入
参数:
-h 目标主机IP地址
-p 目标主机Redis服务器监听端口
G:\Software\redis-64.3.0.503>redis-cli.exe -h 127.0.0.1 -p 6379127.0.0.1:6379> set me wyfOK127.0.0.1:6379> get me"wyf"
三、maven web程序中使用redis
pom.xml添加依赖包
<!-- https://mvnrepository.com/artifact/redis.clients/jedis --> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-pool2</artifactId> <version>2.4.2</version> </dependency>
- 简单的使用,创建Jedis对象传入主机IP地址,端口。并通过get方法获取对象。结束后调用close方法关闭
- 不同的客户端都可以进行访问,因此可以实现内存对象共享功能
@RequestMapping("/g-greet") public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) { String host = "127.0.0.1"; int port = 6379; Jedis jedis = new Jedis(host,port); String strInRedis = jedis.get(name); jedis.close(); model.addAttribute("name", strInRedis); return "greeting"; }
0 0
- windows - redis内存对象使用
- redis的内存使用
- redis使用内存方式
- Redis内存使用优化
- Windows 下使用 Redis
- windows下使用redis
- windows 下redis使用
- Windows 7 Redis 使用
- redis使用Windows版本
- Windows使用Redis
- windows下使用redis
- Windows下使用redis
- redis Windows的使用
- 关于 Redis 内存使用总结
- 4.redis内存使用优化
- Redis内存使用情况分析
- redis使用内存info命令
- 学习windows驱动(内存对象)
- jsp项目错误
- HDU2066:一个人的旅行(最短路)
- Android-ContentObserver内容监听者
- jsp项目基础
- java四种权限修饰符
- windows - redis内存对象使用
- Ajax基础学习笔记二—支持的数据格式
- Mac上安装Tomcat
- 前端——水平垂直居中
- spring-配置文件的读取和解析
- jsp字符有效验证
- MySQL 查询截取分析
- bzoj1002[FJOI2007]轮状病毒 递推+高精度
- Linux内核之进程管理