memcached_store 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/active_support/cache/memcached_store.rb +33 -5
- 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: 51f58b245ce09f4f36a9f095684357fecc3e6ec3a7dfcfe5d37c532c94f3476a
|
4
|
+
data.tar.gz: b5062194ad1fc584c122bfedfc2e9b11f04e05080c702753623b1dc599042885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a0023120d7e6107600871075ece41c802d076fa670ba2ad588bd0a15017544499c88a281f8ab0f6ce067f6179728af0a991013fb7ed0851305776b2cf11b853
|
7
|
+
data.tar.gz: 8aac93c1733e645bbc683eb3d8e6e2099ef553866f0fc9a7278bb4e008190e09df783963bca99c72d00152ecf0bf94eee29582146f5e2c411d587697a5062158
|
@@ -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
|
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.2
|
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-07-26 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.16
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Plugin-able Memcached adapters to add features (compression, safety)
|