redis 的图标挺有意思的
来源:互联网 发布:真人变卡通人物软件 编辑:程序博客网 时间:2024/06/06 02:47
redis 的使用
1.安装redis官网的步骤安装redis (http://redis.io/download)
$ wget http://download.redis.io/releases/redis-2.8.15.tar.gz$ tar xzf redis-2.8.15.tar.gz$ cd redis-2.8.15$ make
2.启动redis
$ src/redis-server
or
后台启动
nohup src/redis-server &
进程
[1] 16461
有意思的提示
root@5254004e45d0:/srv/rorapps/redis/redis-2.8.15# src/redis-server [16445] 16 Sep 09:54:32.684 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf[16445] 16 Sep 09:54:32.686 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.15 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 16445 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [16445] 16 Sep 09:54:32.688 # Server started, Redis version 2.8.15[16445] 16 Sep 09:54:32.688 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.[16445] 16 Sep 09:54:32.688 * The server is now ready to accept connections on port 6379
Ok, 以上redis的服务端完成了
3.客户端使用
这里介绍Rails的使用
Gem
redis-rb (https://github.com/redis/redis-rb)
require "redis"redis = Redis.newredis.set("mykey", "hello world")# => "OK"redis.get("mykey")# => "hello world"
Ok,客户端简单版
4.错误解决
提示
Redis::ProtocolError ( Got 'H' as initial reply byte. If you're in a forking environment, such as Unicorn, you need to connect to Redis after forking. ):
是指你的Redis 服务没有启动
5. 做ActiveRecord对象缓存
http://robbinfan.com/blog/33/activerecord-object-cache
6. dalli/redis
require 'active_support' require 'dalli' require 'active_support/cache/dalli_store' Dalli.logger = $common_logger dalli_opts = { :namespace => "namespace_name", :compress => true, :expires_in => 60.minute } CACHE = ActiveSupport::Cache::DalliStore.new(APP_CONFIG['redis_url'], dalli_opts) DALLI = Dalli::Client.new(APP_CONFIG['redis_url'], dalli_opts) RedisCache = Redis.new(url: APP_CONFIG['redis_url'], :driver => :hiredis) CACHE = ActiveSupport::Cache::RedisStore.new([{:host => APP_CONFIG['redis_url'], :port => 6379, :driver => :hiredis}])
0 0
- redis 的图标挺有意思的
- 真的挺有意思
- 感觉挺有意思的
- 挺有意思的
- 挺有意思的文章。。。
- 挺有意思的
- 挺有意思的夫妻协议
- 一个挺有意思的东西。。
- 挺有意思的一副对联
- 电子邮件图标生成网站,挺有意思
- 挺有意思的比较,JAVA与C#。
- DNS欺骗(挺有意思的一篇文章)
- 第一次使用Blog,呵呵挺有意思的
- [转载]若干个挺有意思的教训
- 挺有意思的,就贴上来了。
- Performance 调试还是挺有意思的!
- 挺有意思的,给小鱼喂食
- 关于数字签名挺有意思的解释
- xcode PBXcp error
- HDU5015 233 Matrix (2014 ACM/ICPC Asia Regional Xi'an Online)
- FP-Tree算法的实现
- ubuntu 下使用 putty 调试
- hadoop测试时出现Too many fetch-failures错误
- redis 的图标挺有意思的
- 改变命运,挑战高薪,逆袭从这里开始!
- cross validation交叉验证
- Linux进阶——Centos crontab command not found解决方法(亲测)
- 在iOS中使用ZXing库
- Eclipse下调试jboss
- 分布式计算框架Hadoop
- php 语言总结
- Java中抽象类和接口的区别