redis_template_resolver 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/lib/redis_template_resolver.rb +9 -3
- data/redis_template_resolver.gemspec +1 -1
- metadata +33 -33
data/CHANGELOG
CHANGED
@@ -183,12 +183,16 @@ class RedisTemplateResolver < ActionView::Resolver
|
|
183
183
|
|
184
184
|
return nil unless @@cache[@template_name]
|
185
185
|
|
186
|
-
|
186
|
+
expiration = @@cache[@template_name][:expiration].to_i
|
187
|
+
|
188
|
+
if expiration <= Time.now.to_i
|
187
189
|
Rails.logger.debug( "Local cache entry is too old, removing!" )
|
188
190
|
@@cache.delete( @template_name )
|
189
191
|
return nil
|
190
192
|
end
|
191
193
|
|
194
|
+
Rails.logger.debug( "Local cache still valid, expiring in #{expiration.inspect}" )
|
195
|
+
|
192
196
|
return @@cache[@template_name][:template]
|
193
197
|
end
|
194
198
|
|
@@ -214,9 +218,11 @@ class RedisTemplateResolver < ActionView::Resolver
|
|
214
218
|
=end
|
215
219
|
def store_template_to_local_cache( template_body, ttl = self.local_cache_ttl )
|
216
220
|
@@cache ||= {}
|
217
|
-
|
221
|
+
|
222
|
+
expiration = Time.now.to_i + ttl
|
223
|
+
Rails.logger.debug( "Caching template locally for #{ttl.inspect} seconds; will expire at #{expiration}" )
|
218
224
|
@@cache[@template_name] = { :template => template_body,
|
219
|
-
:expiration =>
|
225
|
+
:expiration => expiration }
|
220
226
|
|
221
227
|
return template_body
|
222
228
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "redis_template_resolver"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.2"
|
4
4
|
s.homepage = "https://github.com/psd/redis_template_resolver"
|
5
5
|
s.summary = "A template resolver for rails that retrieves templates via http and caches them in redis"
|
6
6
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_template_resolver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,120 +9,120 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
type: :runtime
|
15
16
|
name: redis
|
17
|
+
prerelease: false
|
16
18
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>'
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 3.0.0
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
25
|
requirements:
|
27
26
|
- - ! '>'
|
28
27
|
- !ruby/object:Gem::Version
|
29
28
|
version: 3.0.0
|
29
|
+
none: false
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
+
type: :runtime
|
31
32
|
name: httparty
|
33
|
+
prerelease: false
|
32
34
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
35
|
requirements:
|
35
36
|
- - ! '>'
|
36
37
|
- !ruby/object:Gem::Version
|
37
38
|
version: 0.8.0
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
41
|
requirements:
|
43
42
|
- - ! '>'
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: 0.8.0
|
45
|
+
none: false
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
+
type: :runtime
|
47
48
|
name: rails
|
49
|
+
prerelease: false
|
48
50
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
51
|
requirements:
|
51
52
|
- - ~>
|
52
53
|
- !ruby/object:Gem::Version
|
53
54
|
version: 3.2.6
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
55
|
none: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - ~>
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: 3.2.6
|
61
|
+
none: false
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
+
type: :runtime
|
63
64
|
name: activesupport
|
65
|
+
prerelease: false
|
64
66
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
67
|
requirements:
|
67
68
|
- - ! '>'
|
68
69
|
- !ruby/object:Gem::Version
|
69
70
|
version: 3.2.0
|
70
|
-
type: :runtime
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
71
|
none: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
73
|
requirements:
|
75
74
|
- - ! '>'
|
76
75
|
- !ruby/object:Gem::Version
|
77
76
|
version: 3.2.0
|
77
|
+
none: false
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
+
type: :development
|
79
80
|
name: rspec
|
81
|
+
prerelease: false
|
80
82
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
83
|
requirements:
|
83
84
|
- - ! '>'
|
84
85
|
- !ruby/object:Gem::Version
|
85
86
|
version: 2.10.0
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
87
|
none: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
89
|
requirements:
|
91
90
|
- - ! '>'
|
92
91
|
- !ruby/object:Gem::Version
|
93
92
|
version: 2.10.0
|
93
|
+
none: false
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
+
type: :development
|
95
96
|
name: simplecov
|
97
|
+
prerelease: false
|
96
98
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
99
|
requirements:
|
99
100
|
- - ! '>='
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
103
|
none: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
105
|
requirements:
|
107
106
|
- - ! '>='
|
108
107
|
- !ruby/object:Gem::Version
|
109
108
|
version: '0'
|
109
|
+
none: false
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
+
type: :development
|
111
112
|
name: timecop
|
113
|
+
prerelease: false
|
112
114
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
115
|
requirements:
|
115
116
|
- - ! '>='
|
116
117
|
- !ruby/object:Gem::Version
|
117
118
|
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
119
|
none: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
121
|
requirements:
|
123
122
|
- - ! '>='
|
124
123
|
- !ruby/object:Gem::Version
|
125
124
|
version: '0'
|
125
|
+
none: false
|
126
126
|
description: ! " A template resolver for rails 3.2. It retrieves templates via
|
127
127
|
HTTP \n and stores them in a redis instance, as well as in local caches. \n"
|
128
128
|
email:
|
@@ -145,20 +145,20 @@ rdoc_options: []
|
|
145
145
|
require_paths:
|
146
146
|
- lib
|
147
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
148
|
requirements:
|
150
149
|
- - ! '>='
|
151
150
|
- !ruby/object:Gem::Version
|
152
151
|
version: '0'
|
153
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
152
|
none: false
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
154
|
requirements:
|
156
155
|
- - ! '>='
|
157
156
|
- !ruby/object:Gem::Version
|
158
157
|
version: '0'
|
158
|
+
none: false
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
|
-
rubygems_version: 1.8.
|
161
|
+
rubygems_version: 1.8.24
|
162
162
|
signing_key:
|
163
163
|
specification_version: 3
|
164
164
|
summary: A template resolver for rails that retrieves templates via http and caches
|