redis_page 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redis_page/sweeper.rb +7 -1
- data/lib/redis_page/sweeper_worker.rb +1 -3
- data/lib/redis_page/version.rb +1 -1
- data/redis_page.gemspec +4 -0
- 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: bb31b87f9875d3f864eaa13358561f4769551591
|
4
|
+
data.tar.gz: be607933df2ce92b7d61182074adba4468bbd646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2406f7fd19c3a68ac64508e95f3e186aaefa0f509d2343733aa3edea9fd189a3a5ef0aff4410bcfee623091ccc300ba3f135f43299b524dd59cfc253a7dc9d2
|
7
|
+
data.tar.gz: 36983a0b92863c8c6ddd658e3690ba7689b58a1a2af59f39489cc0e4b3633e3bdc503fb973dee7c8d4085972171c22f7f528f036de3f199ed2e1d848a6d9df5c
|
data/lib/redis_page/sweeper.rb
CHANGED
@@ -27,6 +27,11 @@ module RedisPage
|
|
27
27
|
fetch_infos(urls)
|
28
28
|
end
|
29
29
|
|
30
|
+
# 通过覆写此方法, 达到可以指定redis_page queue的目的
|
31
|
+
def redis_page_queue_name
|
32
|
+
'redis_page'
|
33
|
+
end
|
34
|
+
|
30
35
|
private
|
31
36
|
def add_infos(urls, info)
|
32
37
|
info = JSON.parse(info)
|
@@ -52,7 +57,8 @@ module RedisPage
|
|
52
57
|
|
53
58
|
def self.sweep(info)
|
54
59
|
Rails.logger.info "[page cache]add sweeper job: #{info['url']}-#{info['country']}"
|
55
|
-
|
60
|
+
|
61
|
+
Sidekiq::Client.push('queue' => redis_page_queue_name, 'class' => SweeperWorker, 'args' => [info['url'], info['country']])
|
56
62
|
end
|
57
63
|
end
|
58
64
|
end
|
@@ -3,9 +3,7 @@ require "sidekiq"
|
|
3
3
|
module RedisPage
|
4
4
|
class SweeperWorker
|
5
5
|
include Sidekiq::Worker
|
6
|
-
|
7
|
-
# 相同 url 和 country 的缓存清理请求,在2分钟内只能执行一次
|
8
|
-
sidekiq_options queue: :redis_page, retry: false, unique: :until_timeout, unique_expiration: 2 * 60
|
6
|
+
sidekiq_options retry: false, unique: :until_and_while_executing
|
9
7
|
|
10
8
|
def perform(url, country=nil)
|
11
9
|
uri = URI(url)
|
data/lib/redis_page/version.rb
CHANGED
data/redis_page.gemspec
CHANGED
@@ -9,6 +9,10 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["saberma"]
|
10
10
|
spec.email = ["mahb45@gmail.com"]
|
11
11
|
|
12
|
+
#if spec.respond_to?(:metadata)
|
13
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
14
|
+
#end
|
15
|
+
|
12
16
|
spec.summary = %q{use redis to cache your rails page.}
|
13
17
|
spec.description = %q{use redis to cache your rails page.}
|
14
18
|
spec.homepage = "https://github.com/saberma/redis_page"
|
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.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saberma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|