dalli 2.7.10 → 2.7.11
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dalli might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +10 -0
- data/History.md +11 -2
- data/README.md +4 -27
- data/lib/active_support/cache/dalli_store.rb +8 -2
- data/lib/dalli.rb +1 -1
- data/lib/dalli/client.rb +13 -6
- data/lib/dalli/server.rb +3 -0
- data/lib/dalli/version.rb +1 -1
- metadata +9 -121
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bc4fe873fe9319c9297219b7908d576470551d0e011d1299e54ebc162256a68
|
4
|
+
data.tar.gz: b60393783d05152ad67aa12298f6867127f973fbf07cd2d0dc90ab96b1d7971f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1348b528243f253c111ad74e17a0ba20d8d14eb29d4f41e15f60bb2c87505c6d09404217c868f1623bd68f1ad70a644efd09fd1acca0ba2a1d0b6395387967ae
|
7
|
+
data.tar.gz: 108c5477c6399ef838a8df14e4878509ec5f7c22c33d012c19a9deb635901e9251a52c392c080fd6eb65dfb54e8084ee70cf6668a6914fd1336120aabb19b4f9
|
data/Gemfile
CHANGED
data/History.md
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
Dalli Changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
2.7.11
|
5
|
+
==========
|
6
|
+
- DEPRECATION: :dalli_store will be removed in Dalli 3.0.
|
7
|
+
Use Rails' official :mem_cache_store instead.
|
8
|
+
https://guides.rubyonrails.org/caching_with_rails.html
|
9
|
+
- Add new `digest_class` option to Dalli::Client [#724]
|
10
|
+
- Don't treat NameError as a network error [#728]
|
11
|
+
- Handle nested comma separated server strings (sambostock)
|
12
|
+
|
4
13
|
2.7.10
|
5
14
|
==========
|
6
15
|
- Revert frozen string change (schneems)
|
7
16
|
- Advertise supports_cached_versioning? in DalliStore (schneems)
|
8
|
-
- Better detection of fork support, to allow specs to run under Truffle Ruby
|
9
|
-
- Update logging for over max size to log as error
|
17
|
+
- Better detection of fork support, to allow specs to run under Truffle Ruby (deepj)
|
18
|
+
- Update logging for over max size to log as error (aeroastro)
|
10
19
|
|
11
20
|
2.7.9
|
12
21
|
==========
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Dalli [![Build Status](https://secure.travis-ci.org/petergoldstein/dalli.svg)](http://travis-ci.org/petergoldstein/dalli)
|
1
|
+
Dalli [![Build Status](https://secure.travis-ci.org/petergoldstein/dalli.svg)](http://travis-ci.org/petergoldstein/dalli)
|
2
2
|
=====
|
3
3
|
|
4
4
|
Dalli is a high performance pure Ruby client for accessing memcached servers. It works with memcached 1.4+ only as it uses the newer binary protocol. It should be considered a replacement for the memcache-client gem.
|
@@ -9,26 +9,6 @@ The name is a variant of Salvador Dali for his famous painting [The Persistence
|
|
9
9
|
|
10
10
|
Dalli's initial development was sponsored by [CouchBase](http://www.couchbase.com/). Many thanks to them!
|
11
11
|
|
12
|
-
|
13
|
-
Design
|
14
|
-
------------
|
15
|
-
|
16
|
-
Mike Perham decided to write Dalli after maintaining memcache-client for two years for a few specific reasons:
|
17
|
-
|
18
|
-
0. The code is mostly old and gross. The bulk of the code is a single 1000 line .rb file.
|
19
|
-
1. It has a lot of options that are infrequently used which complicate the codebase.
|
20
|
-
2. The implementation has no single point to attach monitoring hooks.
|
21
|
-
3. Uses the old text protocol, which hurts raw performance.
|
22
|
-
|
23
|
-
So a few notes. Dalli:
|
24
|
-
|
25
|
-
0. uses the exact same algorithm to choose a server so existing memcached clusters with TBs of data will work identically to memcache-client.
|
26
|
-
1. is approximately 20% faster than memcache-client (which itself was heavily optimized) in Ruby 1.9.2.
|
27
|
-
2. contains explicit "chokepoint" methods which handle all requests; these can be hooked into by monitoring tools (NewRelic, Rack::Bug, etc) to track memcached usage.
|
28
|
-
3. supports SASL for use in managed environments, e.g. Heroku.
|
29
|
-
4. provides proper failover with recovery and adjustable timeouts
|
30
|
-
|
31
|
-
|
32
12
|
Supported Ruby versions and implementations
|
33
13
|
------------------------------------------------
|
34
14
|
|
@@ -68,10 +48,7 @@ value = dc.get('abc')
|
|
68
48
|
|
69
49
|
The test suite requires memcached 1.4.3+ with SASL enabled (`brew install memcached --enable-sasl ; mv /usr/bin/memcached /usr/bin/memcached.old`). Currently only supports the PLAIN mechanism.
|
70
50
|
|
71
|
-
Dalli has no runtime dependencies
|
72
|
-
you can optionally install the '[kgio](https://bogomips.org/kgio/)' gem to
|
73
|
-
give Dalli a 20-30% performance boost.
|
74
|
-
|
51
|
+
Dalli has no runtime dependencies.
|
75
52
|
|
76
53
|
Usage with Rails 3.x and 4.x
|
77
54
|
---------------------------
|
@@ -160,7 +137,7 @@ Dalli::Client accepts the following options. All times are in seconds.
|
|
160
137
|
|
161
138
|
**failover**: Boolean, if true Dalli will failover to another server if the main server for a key is down. Default is true.
|
162
139
|
|
163
|
-
**threadsafe**: Boolean. If true Dalli ensures that only one thread is using a socket at a given time.
|
140
|
+
**threadsafe**: Boolean. If true Dalli ensures that only one thread is using a socket at a given time. Default is true. You can set to false if you are using the Client within a thread-safe connection pool.
|
164
141
|
|
165
142
|
**serializer**: The serializer to use for objects being stored (ex. JSON).
|
166
143
|
Default is Marshal.
|
@@ -206,7 +183,7 @@ If serving compressed data using nginx's HttpMemcachedModule, set `memcached_gzi
|
|
206
183
|
Features and Changes
|
207
184
|
------------------------
|
208
185
|
|
209
|
-
By default, Dalli is thread-safe.
|
186
|
+
By default, Dalli is thread-safe. Disable thread-safety at your own peril.
|
210
187
|
|
211
188
|
Dalli does not need anything special in Unicorn/Passenger since 2.0.4.
|
212
189
|
It will detect sockets shared with child processes and gracefully reopen the
|
@@ -50,6 +50,11 @@ module ActiveSupport
|
|
50
50
|
# wish to use pool support.
|
51
51
|
#
|
52
52
|
def initialize(*addresses)
|
53
|
+
puts <<-EOS
|
54
|
+
DEPRECATION: :dalli_store will be removed in Dalli 3.0.
|
55
|
+
Please use Rails' official :mem_cache_store instead.
|
56
|
+
https://guides.rubyonrails.org/caching_with_rails.html
|
57
|
+
EOS
|
53
58
|
addresses = addresses.flatten
|
54
59
|
options = addresses.extract_options!
|
55
60
|
@options = options.dup
|
@@ -341,11 +346,12 @@ module ActiveSupport
|
|
341
346
|
private
|
342
347
|
|
343
348
|
def namespaced_key(key, options)
|
349
|
+
digest_class = @options[:digest_class] || ::Digest::MD5
|
344
350
|
key = expanded_key(key)
|
345
351
|
namespace = options[:namespace] if options
|
346
352
|
prefix = namespace.is_a?(Proc) ? namespace.call : namespace
|
347
353
|
key = "#{prefix}:#{key}" if prefix
|
348
|
-
key = "#{key[0, 213]}:md5:#{
|
354
|
+
key = "#{key[0, 213]}:md5:#{digest_class.hexdigest(key)}" if key && key.size > 250
|
349
355
|
key
|
350
356
|
end
|
351
357
|
alias :normalize_key :namespaced_key
|
@@ -417,7 +423,7 @@ module ActiveSupport
|
|
417
423
|
module LocalCacheEntryUnwrapAndRaw # :nodoc:
|
418
424
|
protected
|
419
425
|
def read_entry(key, options)
|
420
|
-
retval = super
|
426
|
+
retval = super(key, **options)
|
421
427
|
if retval.is_a? ActiveSupport::Cache::Entry
|
422
428
|
# Must have come from LocalStore, unwrap it
|
423
429
|
if options[:raw]
|
data/lib/dalli.rb
CHANGED
@@ -20,7 +20,7 @@ module Dalli
|
|
20
20
|
# application error in marshalling deserialization or decompression
|
21
21
|
class UnmarshalError < DalliError; end
|
22
22
|
# payload too big for memcached
|
23
|
-
class ValueOverMaxSize <
|
23
|
+
class ValueOverMaxSize < DalliError; end
|
24
24
|
|
25
25
|
def self.logger
|
26
26
|
@logger ||= (rails_logger || default_logger)
|
data/lib/dalli/client.rb
CHANGED
@@ -29,6 +29,7 @@ module Dalli
|
|
29
29
|
# - :serializer - defaults to Marshal
|
30
30
|
# - :compressor - defaults to zlib
|
31
31
|
# - :cache_nils - defaults to false, if true Dalli will not treat cached nil values as 'not found' for #fetch operations.
|
32
|
+
# - :digest_class - defaults to Digest::MD5, allows you to pass in an object that responds to the hexdigest method, useful for injecting a FIPS compliant hash object.
|
32
33
|
#
|
33
34
|
def initialize(servers=nil, options={})
|
34
35
|
@servers = normalize_servers(servers || ENV["MEMCACHE_SERVERS"] || '127.0.0.1:11211')
|
@@ -331,13 +332,15 @@ module Dalli
|
|
331
332
|
|
332
333
|
##
|
333
334
|
# Normalizes the argument into an array of servers.
|
334
|
-
# If the argument is a string, it's expected that the URIs are comma separated e.g.
|
335
|
+
# If the argument is a string, or an array containing strings, it's expected that the URIs are comma separated e.g.
|
335
336
|
# "memcache1.example.com:11211,memcache2.example.com:11211,memcache3.example.com:11211"
|
336
337
|
def normalize_servers(servers)
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
338
|
+
Array(servers).flat_map do |server|
|
339
|
+
if server.is_a? String
|
340
|
+
server.split(",")
|
341
|
+
else
|
342
|
+
server
|
343
|
+
end
|
341
344
|
end
|
342
345
|
end
|
343
346
|
|
@@ -378,8 +381,9 @@ module Dalli
|
|
378
381
|
raise ArgumentError, "key cannot be blank" if !key || key.length == 0
|
379
382
|
key = key_with_namespace(key)
|
380
383
|
if key.length > 250
|
384
|
+
digest_class = @options[:digest_class] || ::Digest::MD5
|
381
385
|
max_length_before_namespace = 212 - (namespace || '').size
|
382
|
-
key = "#{key[0, max_length_before_namespace]}:md5:#{
|
386
|
+
key = "#{key[0, max_length_before_namespace]}:md5:#{digest_class.hexdigest(key)}"
|
383
387
|
end
|
384
388
|
return key
|
385
389
|
end
|
@@ -407,6 +411,9 @@ module Dalli
|
|
407
411
|
rescue NoMethodError
|
408
412
|
raise ArgumentError, "cannot convert :expires_in => #{opts[:expires_in].inspect} to an integer"
|
409
413
|
end
|
414
|
+
if opts[:digest_class] && !opts[:digest_class].respond_to?(:hexdigest)
|
415
|
+
raise ArgumentError, "The digest_class object must respond to the hexdigest method"
|
416
|
+
end
|
410
417
|
opts
|
411
418
|
end
|
412
419
|
|
data/lib/dalli/server.rb
CHANGED
@@ -447,6 +447,9 @@ module Dalli
|
|
447
447
|
rescue ArgumentError
|
448
448
|
raise if $!.message !~ /undefined class|marshal data too short/
|
449
449
|
raise UnmarshalError, "Unable to unmarshal value: #{$!.message}"
|
450
|
+
rescue NameError
|
451
|
+
raise if $!.message !~ /uninitialized constant/
|
452
|
+
raise UnmarshalError, "Unable to unmarshal value: #{$!.message}"
|
450
453
|
rescue Zlib::Error
|
451
454
|
raise UnmarshalError, "Unable to uncompress value: #{$!.message}"
|
452
455
|
end
|
data/lib/dalli/version.rb
CHANGED
metadata
CHANGED
@@ -1,128 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dalli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter M. Goldstein
|
8
8
|
- Mike Perham
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: minitest
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 4.2.0
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 4.2.0
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: mocha
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rails
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '5'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '5'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rake
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: appraisal
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: connection_pool
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rdoc
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: simplecov
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
12
|
+
date: 2020-09-26 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
126
14
|
description: High performance memcached client for Ruby
|
127
15
|
email:
|
128
16
|
- peter.m.goldstein@gmail.com
|
@@ -152,9 +40,8 @@ homepage: https://github.com/petergoldstein/dalli
|
|
152
40
|
licenses:
|
153
41
|
- MIT
|
154
42
|
metadata: {}
|
155
|
-
post_install_message:
|
156
|
-
rdoc_options:
|
157
|
-
- "--charset=UTF-8"
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
158
45
|
require_paths:
|
159
46
|
- lib
|
160
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -168,8 +55,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
55
|
- !ruby/object:Gem::Version
|
169
56
|
version: '0'
|
170
57
|
requirements: []
|
171
|
-
|
172
|
-
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 2.7.6.2
|
60
|
+
signing_key:
|
173
61
|
specification_version: 4
|
174
62
|
summary: High performance memcached client for Ruby
|
175
63
|
test_files: []
|