我在我的一个应用程序中使用redis进行缓存,我需要每天存储大约500,000个密钥,并且需要为所有密钥设置EXPIRE.5天后,我将拥有大约250万个密钥,并且我已经为所有密钥设置了EXPIRE.是否可以为键设置EXPIRE并让redis每分钟扫描一次以找出过期密钥(根据文档).这会对性能产生多大影响?
有更好的选择吗?
我试图搜索谷歌,但没有发现性能.我主要担心的是性能和记忆.
PS.目前我的redis因为我的redis服务器上的键太多而空间不足.
我是弹性搜索的新手.我在我的系统中安装了弹性搜索.在localhost:9200它正在显示
{
"ok" : true,
"status" : 200,
"name" : "Unseen",
"version" : {
"number" : "0.90.10",
"build_hash" : "0a5781f44876e8d1c30b6360628d59cb2a7a2bbb",
"build_timestamp" : "2014-01-10T10:18:37Z",
"build_snapshot" : false,
"lucene_version" : "4.6"
},
"tagline" : "You Know, for Search"
}
Run Code Online (Sandbox Code Playgroud)
我在我的宝石文件中包含了这两个宝石.
gem 'tire'
gem 'elasticsearch'
Run Code Online (Sandbox Code Playgroud)
我有一个电影模型和一个名为search_controller的控制器.
movie.rb
class Movie < ActiveRecord::Base
include Tire::Model::Search
include Tire::Model::Callbacks
mapping do
indexes :title
end
def self.search(params)
binding.pry
tire.search(load: true, page: 1, per_page: 10) do
query { string params[:query]} if params[:query].present?
end
Run Code Online (Sandbox Code Playgroud)
迁移电影模型
class CreateMovies < ActiveRecord::Migration
def …Run Code Online (Sandbox Code Playgroud) 我想使用PHP访问用户联系人.
我在/ var/www/oauth目录中有两个名为index.php&validate.php的文件.重定向到validate.php后,它现在显示任何内容.它是在"curl init之前"打印echo而不是在"curl init之后"打印echo.请有人帮帮我.
Google帐户设置: -
Client ID: *********
Email address: *****
Client secret: ******
Redirect URIs: http://localhost/oauth/validate.php
JavaScript origins: http://localhost
Run Code Online (Sandbox Code Playgroud)
这是我的PHP代码.
/var/www/oauth/index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login with gmail</title>
<style type="text/css">
body{background:url(random_grey_variations.png) repeat; }
#wrapper{width:960px; margin:0 auto; margin-top:100px;}
.button{display:block; height:40px; padding:0 20px; width:200px; background:#CCC; text-decoration:none; font:bold 18px Verdana, Geneva, sans-serif; color:#333; line-height:40px; text-align:center; margin-bottom:50px;}
</style>
</head>
<body>
<div id="wrapper">
<!-- <a href="http://webdevelopergeeks.com/tutorial/import-gmail-or-google-contacts-using-php-and-oauth-2-0/" class="button">Back To Article</a> --> …Run Code Online (Sandbox Code Playgroud)