redis_page 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/redis_page/sweeper.rb +6 -2
- data/lib/redis_page/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12fe8841ebb2226842483c46aefb06112e0d47b9
|
4
|
+
data.tar.gz: c9eb24aaba8f066cb27a104769482f6c1d75fd4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af2dcd6a121d123001c696c6b23e27549680df8a4d82296fb844e08cedc1ea4946da7ef941b00d5c5279744870a4876f1fa84bc9a3061907a36a8cc348c059ea
|
7
|
+
data.tar.gz: 40663eda1b7f8bdcaa03a73d15e7902b3e4f015e001eab6b34a83598ad7b0626581384cf50a445425ac9b1a15ab2fcd84604b8d27e1f570027a61254d29ae91f
|
data/README.md
CHANGED
@@ -49,7 +49,9 @@ end
|
|
49
49
|
|
50
50
|
```
|
51
51
|
class ProductController < ActionController::Base
|
52
|
-
caches_redis_page :show
|
52
|
+
caches_redis_page :show # 或者使用下面两行的格式
|
53
|
+
#caches_redis_page :show, append_country: true # cache key 会在 path 后面加上国家代码,例如:/products-US
|
54
|
+
#caches_redis_page :show, unless: Proc.new { params[:preview] } # 带上 preview 参数,则不进行缓存,方便管理员对未保存的内容进行预览
|
53
55
|
|
54
56
|
def show
|
55
57
|
@product = Product.find(params[:id])
|
data/lib/redis_page/sweeper.rb
CHANGED
@@ -45,10 +45,14 @@ module RedisPage
|
|
45
45
|
|
46
46
|
def fetch_infos(urls)
|
47
47
|
urls.values.each do |info|
|
48
|
-
|
49
|
-
SweeperWorker.perform_async(info['url'], info['country'])
|
48
|
+
RedisPage::Sweeper.sweep info
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
52
|
+
|
53
|
+
def self.sweep(info)
|
54
|
+
Rails.logger.info "[page cache]add sweeper job: #{info['url']}-#{info['country']}"
|
55
|
+
SweeperWorker.perform_async(info['url'], info['country'])
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
data/lib/redis_page/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_page
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saberma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|