curl -O http://redis.googlecode.com/files/redis-2.2.2.tar.gz
tar xzf redis-2.2.2.tar.gz
cd redis-2.2.2
make
cp src/redis-server src/redis-cli /usr/bin
redis-server
First step, add redis-rb to your Gemfile:
gem 'redis', '2.1.1'
Then install the gem via Bundler:
bundle install
Lastly, create an initializer in config/initializers/redis.rb and add the following:
$redis = Redis.new(:host => 'localhost', :port => 6379)
This will create a new instance of the Redis client, connected to localhost:6379 (the default), and store it in the global variable $redis.
Let’s check that everything is working by firing up rails console:
]]> $redis=> #<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.2.2)> ]]> $redis.set('chunky', 'bacon')=> "OK" ]]> $redis.get('chunky')=> "bacon"
用screen进入后台起
screen -R redis
redis-server
control + a + d
启动rails + c
$redis.hset 'counter','scaner',50000
分享到:
相关推荐
对于在Rails上使用Redis Store,首先我们需要在Gemfile文件中添加入口 gem 'redis-rails' gem 'redis-rack-cache' # optional 然后我们就会有如下选择: ## Cache Store # config/environments/production.rb...
redis-rails打包了Redis的存储驱动程序,这些驱动程序实现了ActiveSupport片段缓存和ActionDispatch / Rack会话存储API。 以下各节说明如何配置每个存储: Rails片段缓存 在config / environments / production.rb中...
安装将此行添加到应用程序的 Gemfile 中: gem 'pooled_redis'用法使用Redis.new支持的选项将redis部分添加到您的database.yml development : redis : db : 2production : redis : url : ' redis://mymaster ' ...
shoppe-example, 在 Rails 中使用Shoppe平台的示例存储实现 这是一个 Rails 应用程序,它使用 Shoppe 构建。 它具有一个可以爱的设计,以充分演示Shoppe平台提供的功能以及它在 Rails 应用程序中的。 正在启动要开始...
NULL 博文链接:https://hlee.iteye.com/blog/587000
博文链接:https://ziyoujiedao.iteye.com/blog/148307
使用Aptana+Rails开发Rails Web应用 有Aptana的安装配置等等,中文
如果由于某种原因而不是在Rails应用中使用ActionDispatch ,请继续阅读以了解如何ActionDispatch安装/使用此gem! 安装 # Gemfile gem 'redis-actionpack' 用法 如果您将Redis-store与Rails一起使用,请转至以了解...
可以将其视为存储在数据库中的全局哈希,它使用类似于ActiveRecord的简单方法进行操作。 跟踪您不想硬编码到Rails应用程序中的所有全局设置。 您可以存储任何类型的对象。 字符串,数字,数组或任何对象。 安装 ...
可以将其视为存储在数据库中的全局哈希,它使用类似ActiveRecord的简单方法进行操作。 跟踪您不想硬编码到Rails应用程序中的所有全局设置。 您可以存储任何类型的对象。 字符串,数字,数组,布尔值或任何对象。 ...
Ruby On Rails中文教材(PDF)
redis:1.rails默认缓存 2.自定义缓存 3.任务队列
rails, Ruby on Rails 欢迎使用 RailsRails 是一个web应用程序框架,它包括根据 Model-View-Controller ( MVC ) Pattern 创建数据库备份的web应用程序所需的所有内容。理解 MVC Pattern 是理解 Rai
mail_form, 在 Rails 中使用 i18n 验证附件和请求信息,直接从表单发送电子邮件 MailForm Rails 3这个 gem 构建在 ActiveModel 之上,展示如何从 Rails 中提取验证。命名和 i18n,而不需要自己实现。本自述文件指的...
敏捷Rails中文教程 敏捷Rails中文教程 敏捷Rails中文教程
ruby on rails轻松使用
redis-store是一种千篇一律的解决方案,我发现它不能与Rails一起正常使用,这主要是由于问题似乎出在Rack的Abstract::ID类中。 我想要一些有效的方法,所以我公然从Rails的MemCacheStore窃取了代码,并将其转换为...
rails-assets, 在 Rails 中,资产管理的解决 Rails 资产 Bundler 到 Bower 代理本自述文件涉及项目的开发方面。 访问站点了解如何在你的应用程序中使用 Rails 资产。 插件开发设置git clone git@github.com:tenex/r