memcached_store 2.0.3 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_support/cache/memcached_store.rb +16 -17
- data/lib/memcached_store/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: e10f6419ec8c1857e0c229abf521fd9aad22802a
|
4
|
+
data.tar.gz: 37ed05f62f6d27c078a744c44fddefbdf6c5df5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53cfa3d30c9a9340dbb8b423c9476ab6e7e25794b28a019f02e17044e8f894ad13eb4ee99e55bdae58973b6b64ad4680bd564530e4ce62423234faaf271cc715
|
7
|
+
data.tar.gz: d0d2d6ea40085f7dd30627dadc750bc17d3f2655d8070eee8a9dc739ba0df60e5b6314513a189e29fa4a6746b3b83ba2549f25953ac949204aadf5fb1de604fb
|
@@ -67,14 +67,14 @@ module ActiveSupport
|
|
67
67
|
super(options)
|
68
68
|
|
69
69
|
if addresses.first.is_a?(Memcached)
|
70
|
-
@
|
70
|
+
@connection = addresses.first
|
71
71
|
raise "Memcached::Rails is no longer supported, "\
|
72
|
-
"use a Memcached instance instead" if @
|
72
|
+
"use a Memcached instance instead" if @connection.is_a?(Memcached::Rails)
|
73
73
|
else
|
74
74
|
mem_cache_options = options.dup
|
75
75
|
servers = mem_cache_options.delete(:servers)
|
76
76
|
UNIVERSAL_OPTIONS.each { |name| mem_cache_options.delete(name) }
|
77
|
-
@
|
77
|
+
@connection = Memcached.new([*addresses, *servers], mem_cache_options)
|
78
78
|
end
|
79
79
|
|
80
80
|
extend Strategy::LocalCache
|
@@ -100,7 +100,7 @@ module ActiveSupport
|
|
100
100
|
|
101
101
|
handle_exceptions(return_value_on_error: {}) do
|
102
102
|
instrument(:read_multi, names, options) do
|
103
|
-
if raw_values = @
|
103
|
+
if raw_values = @connection.get(keys_to_names.keys)
|
104
104
|
raw_values.each do |key, value|
|
105
105
|
entry = deserialize_entry(value)
|
106
106
|
values[keys_to_names[key]] = entry.value unless entry.expired?
|
@@ -117,7 +117,7 @@ module ActiveSupport
|
|
117
117
|
|
118
118
|
handle_exceptions(return_value_on_error: false) do
|
119
119
|
instrument(:cas, name, options) do
|
120
|
-
@
|
120
|
+
@connection.cas(key, expiration(options)) do |raw_value|
|
121
121
|
entry = deserialize_entry(raw_value)
|
122
122
|
value = yield entry.value
|
123
123
|
break true if read_only
|
@@ -136,7 +136,7 @@ module ActiveSupport
|
|
136
136
|
|
137
137
|
handle_exceptions(return_value_on_error: false) do
|
138
138
|
instrument(:cas_multi, names, options) do
|
139
|
-
@
|
139
|
+
@connection.cas(keys_to_names.keys, expiration(options)) do |raw_values|
|
140
140
|
values = {}
|
141
141
|
|
142
142
|
raw_values.each do |key, raw_value|
|
@@ -163,7 +163,7 @@ module ActiveSupport
|
|
163
163
|
options = merged_options(options)
|
164
164
|
handle_exceptions(return_value_on_error: nil) do
|
165
165
|
instrument(:increment, name, amount: amount) do
|
166
|
-
@
|
166
|
+
@connection.incr(normalize_key(name, options), amount)
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
@@ -172,20 +172,20 @@ module ActiveSupport
|
|
172
172
|
options = merged_options(options)
|
173
173
|
handle_exceptions(return_value_on_error: nil) do
|
174
174
|
instrument(:decrement, name, amount: amount) do
|
175
|
-
@
|
175
|
+
@connection.decr(normalize_key(name, options), amount)
|
176
176
|
end
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
180
|
def clear(options = nil)
|
181
181
|
ActiveSupport::Notifications.instrument("cache_clear.active_support", options || {}) do
|
182
|
-
@
|
182
|
+
@connection.flush
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
186
|
def stats
|
187
187
|
ActiveSupport::Notifications.instrument("cache_stats.active_support") do
|
188
|
-
@
|
188
|
+
@connection.stats
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
@@ -195,7 +195,7 @@ module ActiveSupport
|
|
195
195
|
|
196
196
|
def reset #:nodoc:
|
197
197
|
handle_exceptions(return_value_on_error: false) do
|
198
|
-
@
|
198
|
+
@connection.reset
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
@@ -203,7 +203,7 @@ module ActiveSupport
|
|
203
203
|
|
204
204
|
def read_entry(key, _options) # :nodoc:
|
205
205
|
handle_exceptions(return_value_on_error: nil) do
|
206
|
-
deserialize_entry(@
|
206
|
+
deserialize_entry(@connection.get(escape_key(key)))
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
@@ -213,7 +213,7 @@ module ActiveSupport
|
|
213
213
|
expires_in = expiration(options)
|
214
214
|
value = serialize_entry(entry, options)
|
215
215
|
handle_exceptions(return_value_on_error: false) do
|
216
|
-
@
|
216
|
+
@connection.send(method, escape_key(key), value, expires_in)
|
217
217
|
true
|
218
218
|
end
|
219
219
|
end
|
@@ -221,7 +221,7 @@ module ActiveSupport
|
|
221
221
|
def delete_entry(key, _options) # :nodoc:
|
222
222
|
return true if read_only
|
223
223
|
handle_exceptions(return_value_on_error: false, on_miss: true) do
|
224
|
-
@
|
224
|
+
@connection.delete(escape_key(key))
|
225
225
|
true
|
226
226
|
end
|
227
227
|
end
|
@@ -271,9 +271,8 @@ module ActiveSupport
|
|
271
271
|
|
272
272
|
def expiration(options)
|
273
273
|
expires_in = options[:expires_in].to_i
|
274
|
-
if expires_in > 0 && !options[:raw]
|
275
|
-
|
276
|
-
expires_in += 5.minutes.to_i
|
274
|
+
if expires_in > 0 && options[:race_condition_ttl] && !options[:raw]
|
275
|
+
expires_in += options[:race_condition_ttl].to_i
|
277
276
|
end
|
278
277
|
expires_in
|
279
278
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcached_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Camilo Lopez
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-10-
|
14
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|