memcached_store 2.1.3 → 2.2.1

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
- SHA1:
3
- metadata.gz: e10f6419ec8c1857e0c229abf521fd9aad22802a
4
- data.tar.gz: 37ed05f62f6d27c078a744c44fddefbdf6c5df5c
2
+ SHA256:
3
+ metadata.gz: 8c2e6e07846db81c341bc513b655a969c805145f55c52f601692a5b6a8044c82
4
+ data.tar.gz: 0fb5ae2adb9fabee93ee7f0b5256a0f768354434cb6adc6b1191f987ce8198f4
5
5
  SHA512:
6
- metadata.gz: 53cfa3d30c9a9340dbb8b423c9476ab6e7e25794b28a019f02e17044e8f894ad13eb4ee99e55bdae58973b6b64ad4680bd564530e4ce62423234faaf271cc715
7
- data.tar.gz: d0d2d6ea40085f7dd30627dadc750bc17d3f2655d8070eee8a9dc739ba0df60e5b6314513a189e29fa4a6746b3b83ba2549f25953ac949204aadf5fb1de604fb
6
+ metadata.gz: 1ac0741c64d3a5fe6d58915656d6d29984a133d41d6ce84f07535486ea1a707acad670831458f60b6d4fa8a25ea4de1b7e2cee7c03948b6c11c676b9bd595572
7
+ data.tar.gz: f683b364d84ebd7672ca9cfd3c6f00e5941730aec8636a07147f1a0a8277d3cc0c73eb686a028f316a2c36c7d34e43051621e4f15bc14860dac781246acc6d19
@@ -58,6 +58,8 @@ module ActiveSupport
58
58
 
59
59
  attr_accessor :read_only, :swallow_exceptions
60
60
 
61
+ prepend(Strategy::LocalCache)
62
+
61
63
  def initialize(*addresses, **options)
62
64
  addresses = addresses.flatten
63
65
  options[:codec] ||= Codec.new
@@ -76,8 +78,19 @@ module ActiveSupport
76
78
  UNIVERSAL_OPTIONS.each { |name| mem_cache_options.delete(name) }
77
79
  @connection = Memcached.new([*addresses, *servers], mem_cache_options)
78
80
  end
81
+ end
82
+
83
+ def append(name, value, options = nil)
84
+ return true if read_only
85
+ options = merged_options(options)
86
+ normalized_key = normalize_key(name, options)
79
87
 
80
- extend Strategy::LocalCache
88
+ handle_exceptions(return_value_on_error: nil, on_miss: false, miss_exceptions: [Memcached::NotStored]) do
89
+ instrument(:append, name) do
90
+ @connection.append(normalized_key, value)
91
+ end
92
+ true
93
+ end
81
94
  end
82
95
 
83
96
  def write(*)
@@ -121,7 +134,7 @@ module ActiveSupport
121
134
  entry = deserialize_entry(raw_value)
122
135
  value = yield entry.value
123
136
  break true if read_only
124
- serialize_entry(Entry.new(value, options), options)
137
+ serialize_entry(Entry.new(value, **options), options)
125
138
  end
126
139
  end
127
140
  true
@@ -149,7 +162,7 @@ module ActiveSupport
149
162
  break true if read_only
150
163
 
151
164
  serialized_values = values.map do |name, value|
152
- [normalize_key(name, options), serialize_entry(Entry.new(value, options), options)]
165
+ [normalize_key(name, options), serialize_entry(Entry.new(value, **options), options)]
153
166
  end
154
167
 
155
168
  Hash[serialized_values]
@@ -256,7 +269,7 @@ module ActiveSupport
256
269
  end
257
270
 
258
271
  def deserialize_entry(value)
259
- if value
272
+ unless value.nil?
260
273
  value.is_a?(Entry) ? value : Entry.new(value, compress: false)
261
274
  end
262
275
  end
@@ -277,9 +290,9 @@ module ActiveSupport
277
290
  expires_in
278
291
  end
279
292
 
280
- def handle_exceptions(return_value_on_error:, on_miss: return_value_on_error)
293
+ def handle_exceptions(return_value_on_error:, on_miss: return_value_on_error, miss_exceptions: [])
281
294
  yield
282
- rescue Memcached::NotFound, Memcached::ConnectionDataExists
295
+ rescue Memcached::NotFound, Memcached::ConnectionDataExists, *miss_exceptions
283
296
  on_miss
284
297
  rescue Memcached::Error => e
285
298
  log_warning(e)
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module MemcachedStore
3
- VERSION = "2.1.3"
3
+ VERSION = "2.2.1"
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.1.3
4
+ version: 2.2.1
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-31 00:00:00.000000000 Z
14
+ date: 2021-05-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -33,14 +33,14 @@ dependencies:
33
33
  requirements:
34
34
  - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: 1.8.0
36
+ version: '1.8'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: 1.8.0
43
+ version: '1.8'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: rake
46
46
  requirement: !ruby/object:Gem::Requirement
@@ -55,6 +55,34 @@ dependencies:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: mocha
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ - !ruby/object:Gem::Dependency
73
+ name: timecop
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
58
86
  description: Plugin-able Memcached adapters to add features (compression, safety)
59
87
  email:
60
88
  - camilo@camilolopez.com
@@ -75,7 +103,8 @@ files:
75
103
  homepage: https://github.com/Shopify/memcached_store/
76
104
  licenses:
77
105
  - MIT
78
- metadata: {}
106
+ metadata:
107
+ allowed_push_host: https://rubygems.org
79
108
  post_install_message:
80
109
  rdoc_options: []
81
110
  require_paths:
@@ -91,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
120
  - !ruby/object:Gem::Version
92
121
  version: '0'
93
122
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.6.14
123
+ rubygems_version: 3.2.17
96
124
  signing_key:
97
125
  specification_version: 4
98
126
  summary: Plugin-able Memcached adapters to add features (compression, safety)