memcached_store 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cff56eb9da5ff4283dbdb070dbcccb23fcb59c834a3a4d66e158720b0a594fe6
4
- data.tar.gz: 306470c390a690087d0bee0628b8f35300fe8330a818d51ec391ba522f3f6441
3
+ metadata.gz: 51f58b245ce09f4f36a9f095684357fecc3e6ec3a7dfcfe5d37c532c94f3476a
4
+ data.tar.gz: b5062194ad1fc584c122bfedfc2e9b11f04e05080c702753623b1dc599042885
5
5
  SHA512:
6
- metadata.gz: 4c97659aad0e6f75d89005a2b69306ca3387395b1924f92563c195c97cc812fb82187908c11c557346ec9c1e705c5140f367a0e49b2919ed43487dd4e42dc508
7
- data.tar.gz: 7c9b0891c23dddfe4f01aba246dd187393207d4a8962f491b358f32d8e0ee83b532eca81f64e670e609d1dfffa294d9a3f22a68bced26291aaff4cbea07f8e01
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
- super(options)
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
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module MemcachedStore
3
- VERSION = "2.3.1"
3
+ VERSION = "2.3.2"
4
4
  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.1
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: 2021-08-02 00:00:00.000000000 Z
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.2.20
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)