memcached_store 2.3.1 → 2.3.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 +35 -7
- data/lib/memcached_store/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8507199bd505d8f8bc31a7266f5a2d7e4ac5074196fcb4a1fb8e9da07fb74a4
|
4
|
+
data.tar.gz: 29b746b2b7586d586bb0d44f2df2223b9bd66c825063fe83bc4cc226d9c6ee7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4944335f6f818cce3a31dbb9ae7c4bead9241207c4f3950b20b725e702bb90189bbfa236ad5aff2176266663d4c54611fce0c2fd9367fa81b511248d8cdd3669
|
7
|
+
data.tar.gz: d57b56acbbbcd9115acc9150140edd5be941dc8f0c55e2621b953ee951d4f1c6d29be558516cda0d0bccdb4b2d97d3a4cd43b9b1614a725d6be7be447b5192aa
|
@@ -67,7 +67,13 @@ module ActiveSupport
|
|
67
67
|
@swallow_exceptions = true
|
68
68
|
@swallow_exceptions = options.delete(:swallow_exceptions) if options.key?(:swallow_exceptions)
|
69
69
|
|
70
|
-
|
70
|
+
if options.key?(:coder)
|
71
|
+
raise ArgumentError, "ActiveSupport::Cache::MemcachedStore doesn't support custom coders"
|
72
|
+
end
|
73
|
+
|
74
|
+
# We don't use a coder, so we set it to nil so Active Support don't think we're using
|
75
|
+
# a deprecated one.
|
76
|
+
super(options.merge(coder: nil))
|
71
77
|
|
72
78
|
if addresses.first.is_a?(Memcached)
|
73
79
|
@connection = addresses.first
|
@@ -128,18 +134,27 @@ module ActiveSupport
|
|
128
134
|
def cas(name, options = nil)
|
129
135
|
options = merged_options(options)
|
130
136
|
key = normalize_key(name, options)
|
137
|
+
payload = nil
|
131
138
|
|
132
|
-
handle_exceptions(return_value_on_error: false) do
|
139
|
+
success = handle_exceptions(return_value_on_error: false) do
|
133
140
|
instrument(:cas, name, options) do
|
134
141
|
@connection.cas(key, expiration(options)) do |raw_value|
|
135
142
|
entry = deserialize_entry(raw_value)
|
136
143
|
value = yield entry.value
|
137
144
|
break true if read_only
|
138
|
-
serialize_entry(Entry.new(value, **options), options)
|
145
|
+
payload = serialize_entry(Entry.new(value, **options), options)
|
139
146
|
end
|
140
147
|
end
|
141
148
|
true
|
142
149
|
end
|
150
|
+
|
151
|
+
if success
|
152
|
+
local_cache.write_entry(key, payload) if local_cache
|
153
|
+
else
|
154
|
+
local_cache.delete_entry(key) if local_cache
|
155
|
+
end
|
156
|
+
|
157
|
+
success
|
143
158
|
end
|
144
159
|
|
145
160
|
def cas_multi(*names, **options)
|
@@ -148,9 +163,11 @@ module ActiveSupport
|
|
148
163
|
options = merged_options(options)
|
149
164
|
keys_to_names = Hash[names.map { |name| [normalize_key(name, options), name] }]
|
150
165
|
|
166
|
+
sent_payloads = nil
|
167
|
+
|
151
168
|
handle_exceptions(return_value_on_error: false) do
|
152
169
|
instrument(:cas_multi, names, options) do
|
153
|
-
@connection.cas(keys_to_names.keys, expiration(options)) do |raw_values|
|
170
|
+
written_payloads = @connection.cas(keys_to_names.keys, expiration(options)) do |raw_values|
|
154
171
|
values = {}
|
155
172
|
|
156
173
|
raw_values.each do |key, raw_value|
|
@@ -166,8 +183,19 @@ module ActiveSupport
|
|
166
183
|
[normalize_key(name, options), serialize_entry(Entry.new(value, **options), options)]
|
167
184
|
end
|
168
185
|
|
169
|
-
Hash[serialized_values]
|
186
|
+
sent_payloads = Hash[serialized_values]
|
187
|
+
end
|
188
|
+
|
189
|
+
if local_cache && sent_payloads
|
190
|
+
sent_payloads.each_key do |key|
|
191
|
+
if written_payloads.key?(key)
|
192
|
+
local_cache.write_entry(key, written_payloads[key])
|
193
|
+
else
|
194
|
+
local_cache.delete_entry(key)
|
195
|
+
end
|
196
|
+
end
|
170
197
|
end
|
198
|
+
|
171
199
|
true
|
172
200
|
end
|
173
201
|
end
|
@@ -322,8 +350,8 @@ module ActiveSupport
|
|
322
350
|
end
|
323
351
|
end
|
324
352
|
|
325
|
-
def serialize_entry(entry, options)
|
326
|
-
if options[:raw]
|
353
|
+
def serialize_entry(entry, options = nil)
|
354
|
+
if options && options[:raw]
|
327
355
|
entry.value.to_s
|
328
356
|
else
|
329
357
|
entry
|
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.3.
|
4
|
+
version: 2.3.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:
|
14
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.4.20
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Plugin-able Memcached adapters to add features (compression, safety)
|