nomo 0.0.34 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nomo/model.rb +5 -5
- data/lib/nomo/page.rb +1 -5
- data/lib/nomo/version.rb +1 -1
- data/lib/nomo.rb +19 -19
- metadata +5 -5
data/lib/nomo/model.rb
CHANGED
@@ -3,17 +3,17 @@ module Nomo
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
def save(*)
|
6
|
-
Nomo.
|
6
|
+
Nomo.multi
|
7
7
|
return_value = super
|
8
|
-
Nomo.
|
8
|
+
Nomo.exec
|
9
9
|
|
10
10
|
return_value
|
11
11
|
end
|
12
12
|
|
13
13
|
def destroy
|
14
|
-
Nomo.
|
14
|
+
Nomo.multi
|
15
15
|
return_value = super
|
16
|
-
Nomo.
|
16
|
+
Nomo.exec
|
17
17
|
|
18
18
|
return_value
|
19
19
|
end
|
@@ -55,7 +55,7 @@ module Nomo
|
|
55
55
|
modify_page_method = :"modify_#{association}_#{name}_page"
|
56
56
|
|
57
57
|
define_method modify_page_method do
|
58
|
-
for record in [send(association)]
|
58
|
+
for record in [*send(association)]
|
59
59
|
record.send(:"modify_#{name}_page")
|
60
60
|
end
|
61
61
|
end
|
data/lib/nomo/page.rb
CHANGED
@@ -27,7 +27,7 @@ module Nomo
|
|
27
27
|
@last_modified = Time.now.utc
|
28
28
|
|
29
29
|
redis.set(key, last_modified.to_f)
|
30
|
-
Nomo.
|
30
|
+
Nomo.publish("updates", key) unless options[:publish].eql?(false) || !realtime?
|
31
31
|
end
|
32
32
|
|
33
33
|
def cache_key
|
@@ -49,9 +49,5 @@ module Nomo
|
|
49
49
|
def redis
|
50
50
|
Nomo.redis
|
51
51
|
end
|
52
|
-
|
53
|
-
def logger
|
54
|
-
Nomo.logger
|
55
|
-
end
|
56
52
|
end
|
57
53
|
end
|
data/lib/nomo/version.rb
CHANGED
data/lib/nomo.rb
CHANGED
@@ -73,40 +73,40 @@ module Nomo
|
|
73
73
|
@logger || ::Rails.logger
|
74
74
|
end
|
75
75
|
|
76
|
-
@
|
77
|
-
@
|
76
|
+
@multi_count = 0
|
77
|
+
@updates = []
|
78
78
|
|
79
|
-
def
|
80
|
-
if @
|
79
|
+
def multi
|
80
|
+
if @multi_count == 0
|
81
81
|
Nomo.redis.multi
|
82
|
-
Nomo.logger.debug("(nomo)
|
82
|
+
Nomo.logger.debug("(nomo) Nomo.multi")
|
83
83
|
end
|
84
84
|
|
85
|
-
@
|
85
|
+
@multi_count += 1
|
86
86
|
end
|
87
87
|
|
88
|
-
def
|
89
|
-
if @
|
90
|
-
for key in @
|
88
|
+
def exec
|
89
|
+
if @multi_count == 1
|
90
|
+
for key in @updates.uniq
|
91
91
|
Nomo.redis.publish("updates", key)
|
92
|
-
Nomo.logger.debug("(nomo) update published -- #{key}
|
92
|
+
Nomo.logger.debug("(nomo) update published -- #{key}")
|
93
93
|
end
|
94
|
-
@
|
94
|
+
@updates = []
|
95
95
|
|
96
96
|
Nomo.redis.exec
|
97
|
-
Nomo.logger.debug("(nomo)
|
97
|
+
Nomo.logger.debug("(nomo) Nomo.exec")
|
98
98
|
end
|
99
99
|
|
100
|
-
@
|
100
|
+
@multi_count -= 1
|
101
101
|
end
|
102
102
|
|
103
|
-
def
|
104
|
-
if @
|
105
|
-
Nomo.redis.publish(
|
106
|
-
Nomo.logger.debug("(nomo) update published -- #{key}
|
103
|
+
def publish(channel, msg)
|
104
|
+
if @multi_count == 0
|
105
|
+
Nomo.redis.publish(channel, msg)
|
106
|
+
Nomo.logger.debug("(nomo) update published -- #{key}")
|
107
107
|
else
|
108
|
-
@
|
109
|
-
Nomo.logger.debug("(nomo) update queued -- #{key}
|
108
|
+
@updates << key
|
109
|
+
Nomo.logger.debug("(nomo) update queued -- #{key}")
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.35
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement: &
|
16
|
+
requirement: &70296875606200 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70296875606200
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redis-namespace
|
27
|
-
requirement: &
|
27
|
+
requirement: &70296875605780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70296875605780
|
36
36
|
description: 304 Not Modified Headers made easy.
|
37
37
|
email:
|
38
38
|
- sausman@stackd.com
|